35 views

Uploaded by Pritam Saha

Important question of DS

- Repa Haskell
- openxlsx
- Java Programming_Module 1
- Binary Search Algorithm
- Array
- A031010104.pdf
- Data Structure & Algorithm Analysis
- image segmentation
- Excel Data Logging
- Arrays.pdf
- Lab4 Structures (1)
- ps i qs
- CS575_prog2.pdf
- 1
- FILE ORG
- Matlab Structure
- Mc0067 Database Set1
- Data Structuer FINAL Index
- 00077135
- FinalClass 9

You are on page 1of 5

example.

linear

A

array is a list of finite

number n of homogeneous data elements

such that :

a) The elements of the array are

referenced respectively by an index

set consisting of n consecutive

numbers.

b) The elements of the array are stored

respectively in successive memory

locations.

The number n of elements is called the length or size of the array.

Two-dimensional Arrays

An array keeps track of multiple pieces of information in linear order, a onedimensional list. However, the data associated with certain systems (a digital

image, a board game, etc.) lives in two dimensions. To visualize this data, we

need a multi-dimensional data structure, that is, a multi-dimensional array. A

two-dimensional array is really nothing more than an array of arrays (a threedimensional array is an array of arrays of arrays).

A two-dimensional array looks like this:

int[][] myArray = { {0,1,2,3}, {3,2,1,0}, {3,5,6,1}, {3,8,3,4} };

(b) What is sorting? How Bubble sort algorithm works (p4.10, also see

algorithm 4.4,

p4.11). Practice the exercise: Ex. 4.7, p4.10

Sorting is nothing but storage of data in sorted order, it can be in ascending or descending order.

The term Sorting comes into picture with the term Searching.

Sorting arranges data in a sequence which makes searching easier.

1.

2.

3.

a)

Set PTR: =1.[Initializes pass pointer PTR]

Repeat while PTR<=N-K: [Executes pass]

If DATA[PTR]>DATA[PTR+1],then:

TEMP := A[PTR], A[PTR] := A[PTR+1], A[PTR+1] := temp

[End of if structure]

b) Set PTR: =PTR+1

[End of inner loop]

[End of step 1 Outer loop]

2. (a) Define linear and binary search. Write their algorithms (Algorithm 4.5,

p4.13 andAlgorithm 4.6, p4.16).

Linear Search

A linear search is the basic and simple search algorithm. A linear search searches an element or

value from an array till the desired element or value is not found and it searches in a sequence

order. It compares the element with all the other elements given in the list and if the element is

matched it returns the value index else it return -1. Linear Search is applied on the unsorted or

unordered list when there are fewer elements in a list.

Binary Search

Binary Search is applied on the sorted array or list. In binary search, we first compare the value with

the elements in the middle position of the array. If the value is matched, then we return the value. If

the value is less than the middle element, then it must lie in the lower half of the array and if it's

greater than the element then it must lie in the upper half of the array. We repeat this procedure on

the lower (or upper) half of the array. Binary Search is useful when there are large numbers of

elements in an array.

- Repa HaskellUploaded byakshayhazari8281
- openxlsxUploaded byPedroM.F.Nakashima
- Java Programming_Module 1Uploaded bychavanvikas57
- Binary Search AlgorithmUploaded bySalman Ahmed
- ArrayUploaded byYacob Hartawan
- A031010104.pdfUploaded byIOSRJEN : hard copy, certificates, Call for Papers 2013, publishing of journal
- Data Structure & Algorithm AnalysisUploaded byBadrul Amin
- image segmentationUploaded bychaithra580
- Excel Data LoggingUploaded byBiiK007
- Arrays.pdfUploaded byBea Oro
- Lab4 Structures (1)Uploaded bySattish Somunaidu
- ps i qsUploaded bySiva Sankar Sankar
- CS575_prog2.pdfUploaded byHarsha Madhwani
- 1Uploaded bydddcdr
- FILE ORGUploaded byLjSinamban
- Matlab StructureUploaded byShah Khan
- Mc0067 Database Set1Uploaded byParvez Alam
- Data Structuer FINAL IndexUploaded byAnonymous sus3ugOxkw
- 00077135Uploaded byStoriesofsuperheroes
- FinalClass 9Uploaded byKrishnajyoti Das
- chapter_VUploaded bybree789
- ECE463_Fall2018_Lab01Uploaded byDebajyoti Datta
- CS304 Final Term Spring 2010 09Uploaded byAzeem Tariq
- Session 01Uploaded byVast H keen
- chapter 1Uploaded bySandeep Goyal
- 2.DataTypes Control Statements OperatorsUploaded byKolachalama Mythili
- Profile Matching in Solving Rank ProblemUploaded byAndysah Putra Utama Siahaan
- CLIPS Curs UtilUploaded byciarmel
- DrishtiUploaded bygaurav
- Empirical Analysis of Radix Sort using Curve Fitting Technique in Personal ComputerUploaded byIRJET Journal

- Link Budget CalculationUploaded byRicha Budhiraja
- FIX UPUploaded byPritam Saha
- FIX UP.docxUploaded byPritam Saha
- HR FAQUploaded byPritam Saha
- Pritam Saha CVUploaded byPritam Saha
- CV Pritam SahaUploaded byPritam Saha
- New Microsoft Word Document (3)Uploaded byPritam Saha
- Data Mining QuestionsUploaded byPritam Saha

- Franzini Book.pdfUploaded bySaadTahir
- Ship-to-Ship_Interaction_during_Overtaki.pdfUploaded bySalma Sherbaz
- Fluent Gambit_Tips and TricksUploaded byMehran Moradi
- What is Alternating CurrentUploaded bymasti0
- July 2013 California Today, PLanning and Conservation League NewsletterUploaded byPLanning and Conservation League
- A Project Report on Cadbury 75 PagesUploaded byRenju Romals
- MisFIT Meal Plan Week 2 CopyUploaded byernicholec
- NPN TransistorUploaded bysphinx
- High Dive Unit ProblemUploaded byssooshi
- Pmr Ecmls12 DraftUploaded byravikumarsid2990
- Foreign Exchange MarketUploaded byFarhad Reza
- Fan Uc Manuals 1789Uploaded bySergio Garcia
- evaluation of time seriesUploaded byKarina Cerda Oñate
- Measuring and Monitoring Relays _ ABBUploaded bypevare
- JSA - Crane SetupUploaded byAbdullah Ghannam
- Oral Submucous FIbrosisUploaded byAsma Nawaz
- IMPACT OF MOLE DRAINS AND N-FERTILIZER RATES ON SOME SOIL PROPERTIES AND SUGAR BEET PRODUCTION IN CLAY SOILUploaded byIJAR Journal
- SKFUploaded byAlex Lins
- ELEX_RF.pdfUploaded byKarumon Utsumi
- Photoshop for 3DUploaded bySri Harsha Rongala
- Honeywell Vista 15p Honeywell Vista 20p Install GuideUploaded byAlarm Grid Home Security and Alarm Monitoring
- EcoUploaded bykarolynacostaufes
- 1.1 Breast SurgeryUploaded byj.doe.hex_87
- AmbienUploaded byE
- Investigation of Different Equipment Setups for Ammonia Wash and DesulfurizationUploaded byyasir
- Animal Crossing WalkthroughUploaded byeipnvn7
- Wolf Richard VISH211-IUploaded bySwami Meera
- 9709_m17_qp_12 AS LEVEL MATHEMATICSUploaded bycharlene
- DRUN LEVEL CONTROL.pptxUploaded byAshvani Shukla
- DeforestationUploaded bythangave2000