Lecture 1.2.2

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

UNIVERSITY INSTITUTE OF

ENGINEERING
DEPARTMENT OF COMPUTER
SCIENCE AND ENGG.
Bachelor of Engineering (Computer Science & Engineering)
DATA STRUCTURES CST-231
Prepared by: Er. Navjyot Kaur- E8508

DISCOVER . LEARN . EMPOWER


Contents
• Traversing, Insert, and Delete Algorithms
Traverse Operation

• This operation is to traverse through the elements of an array.


• Example
• Following program traverses and prints the elements of an array:
• When we compile and execute the above program, it produces the
following result −
Insertion Operation

• Insert operation is to insert one or more data elements into an


array. Based on the requirement, a new element can be added at
the beginning, end, or any given index of array.
• Here, we see a practical implementation of insertion operation,
where we add data at the end of the array −
Deletion Operation

• Deletion refers to removing an existing element from the array and


re-organizing all elements of an array.
• Algorithm
• Consider LA is a linear array with N elements and K is a positive
integer such that K<=N. Following is the algorithm to delete an
element available at the Kth position of LA.
Example
Search Operation

• You can perform a search for an array element based on its value or
its index.
• Algorithm
Consider LA is a linear array with N elements and K is a positive
integer such that K<=N. Following is the algorithm to find an
element with a value of ITEM using sequential search.
Example
REFERENCES

• Lipschutz, Seymour, “Data Structures”, Schaum's Outline Series, Tata McGraw Hill.
• Goodrich, Michael T., Tamassia, Roberto, and Mount, David M., “Data Structures and Algorithms in C++”, Wiley
Student Edition.
• Gilberg/Forouzan,” Data Structure with C ,Cengage Learning.
• Augenstein,Moshe J , Tanenbaum, Aaron M, “Data Structures using C and C++”, Prentice Hall of India
• https://www.tutorialspoint.com/data_structures_algorithms/algorithms_basics.htm
• https://www.cs.utexas.edu/users/djimenez/utsa/cs1723/lecturehtml

You might also like