Intro - To - Data Structure - Lec - 1
Intro - To - Data Structure - Lec - 1
Lecture No. 1
Books to Follow
Data Structure using C and C++ by Aaron Tanenbaum, Yedidyah Langsam An introduction to Data Structures with Applications by Jean-Paul Tremblay, Paul G. Sorenson. Data Structures and Program Design in C++ by Robert L. Kruse,Alexander J. Ryba Data Structures and Algorithm Analysis in C by Mark Allan Weises.
Grading
Grading
Quiz
Late Policy: Assignments will not be accepted later than the deadline.
Plagiarism Policy
Any assignment found 30% or more copied from the internet will be marked 0 (ZERO). Any assignment copied from the class mate will also be marked 0 (ZERO). No consideration will be made regarding plagiarized assignments.
Attendance Policy
Data structure is a representation of data and the operations allowed on that data. A data structure is a way to store and organize data in order to facilitate the access and modifications. Data Structure is the method of representing logical relationships between individual data elements related to the solution of a given problem.
A data structure is said to be linear if its elements form a sequence or a linear list. Examples:
Arrays
Linked
Stacks
Lists
Queues
A data structure is said to be non-linear if its elements does not form a sequence or a linear list. Examples:
Trees
Graphs Hash
Tables
Each element may be connected with two or more other nodes or items in a non-linear arrangement.
Linked list
tree
queue stack
Traversal: Travel through the data structure Search: Traversal through the data structure for a given element Insertion: Adding new elements to the data structure Deletion: Removing an element from the data structure Sorting: Arranging the elements in some type of order Merging: Combining two similar data structures into one
Arrays
A sequence of n items of the same data type that are stored contiguously in computer memory and made accessible by specifying a value of the arrays index. Properties: fixed length (need preliminary reservation of memory) contiguous memory locations direct a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[0] access a[9] Insert/delete
1 2 3 4 5 6 7 8 9 10
Array a with 10 integer elements
Linked List
A sequence of zero or more nodes each containing two kinds of information: some data and one or more links called pointers to other nodes of the linked list. Properties
Stacks
A stack is a data structure that uses last-in, firstout (LIFO) ordering and allows reading and writing on the top element only. Properties
insertion/deletion can be done only at the top LIFO
Two operations
Push Pop
Queues
Collection with access only to the item that has been present the longest Properties
Insertion/enqueue from the rear (back) and deletion/ dequeue from the front. FIFO
Two operations
Enqueue Dequeue
Front
20
30
10
60
57
29
Back
Graphs
Graph
Trees
A Tree is a way of representing the hierarchical nature of a structure in a graphical form. Properties of trees
Examples?
An ADT is a mathematical model, together with various operations defined on the model
Data Structures
ADTs support abstraction, encapsulation, and information hiding. Abstraction is the structuring of a problem into welldefined entities by defining their data and operations. The principle of hiding the used data structure and to only provide a well-defined interface is known as encapsulation.
Algorithm
An algorithm is a well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time.
Important features
well-ordered
unambiguous
Representation
natural
Analysis of algorithm
To analyse an algorithm the most important factors is to calculate resources needed for running the algorithm.
Summary
A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. Linear Data Structures