0% found this document useful (0 votes)
20 views32 pages

Data Structures Lecture Notes CS8391

The document outlines the syllabus for the course CS8391 Data Structures. It covers 5 units - linear data structures like lists, stacks, queues and trees, non-linear data structures like graphs, and searching, sorting and hashing techniques. Example implementations and applications are discussed for each data structure.

Uploaded by

DIVAKAR .K.G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views32 pages

Data Structures Lecture Notes CS8391

The document outlines the syllabus for the course CS8391 Data Structures. It covers 5 units - linear data structures like lists, stacks, queues and trees, non-linear data structures like graphs, and searching, sorting and hashing techniques. Example implementations and applications are discussed for each data structure.

Uploaded by

DIVAKAR .K.G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JEPPIAAR INSTITUTE OF TECHNOLOGY

“Self Belief | Self Discipline | Self Respect”

DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING

LECTURE NOTES

CS8391 / DATA STRUCTURES


(2017 Regulation)
Year/Semester: II / 03

Prepared by

Dr. K. Tamilarasi,

Professor / Dept. of CSE.


SYLLABUS

CS8391 DATA STRUCTURES LTPC 3003

UNIT I LINEAR DATA STRUCTURES – LIST 9


Abstract Data Types (ADTs) – List ADT – array-based implementation – linked list
implementation ––singly linked lists- circularly linked lists- doubly-linked lists – applications
of lists –Polynomial Manipulation – All operations (Insertion, Deletion, Merge, Traversal).

UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES 9


Stack ADT – Operations - Applications - Evaluating arithmetic expressions-
Conversion of Infix to postfix expression - Queue ADT – Operations - Circular Queue –
Priority Queue - deQueue – applications of queues.

UNIT III NON LINEAR DATA STRUCTURES – TREES 9


Tree ADT – tree traversals - Binary Tree ADT – expression trees – applications of
trees – binary search tree ADT –Threaded Binary Trees- AVL Trees – B-Tree - B+ Tree -
Heap – Applications of heap.

UNIT IV NON LINEAR DATA STRUCTURES - GRAPHS 9


Definition – Representation of Graph – Types of graph - Breadth-first traversal -
Depth-first traversal – Topological Sort – Bi-connectivity – Cut vertex – Euler circuits –
Applications of graphs.

UNIT V SEARCHING, SORTING AND HASHING TECHNIQUES 9


Searching- Linear Search - Binary Search. Sorting - Bubble sort - Selection sort -
Insertion sort - Shell sort – Radix sort. Hashing- Hash Functions – Separate Chaining –
Open Addressing – Rehashing – Extendible Hashing.
TOTAL: 45 PERIODS

TEXT BOOKS:
1. Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd Edition, Pearson
Education,1997.
2. ReemaThareja, “Data Structures Using C”, Second Edition , Oxford University Press,
2011
REFERENCES:
1. Thomas H. Cormen, Charles E. Leiserson, Ronald [Link], Clifford Stein, “Introduction to
Algorithms", Second Edition, Mcgraw Hill, 2002.
2. Aho, Hopcroft and Ullman, “Data Structures and Algorithms”, Pearson Education,1983.
3. Stephen G. Kochan, “Programming in C”, 3rd edition, Pearson Education.

Common questions

Powered by AI

Linked list implementations offer advantages over array-based implementations in terms of dynamic memory allocation, allowing the list to grow or shrink in size without the need for pre-allocation of a fixed size. This leads to efficient use of memory. Unlike arrays, linked lists facilitate easier insertion and deletion processes, as these operations do not require shifting elements, thereby improving performance in scenarios where such operations are frequent. Moreover, linked lists can achieve constant time complexity for insertions and deletions versus the O(n) time complexity for arrays where 'n' is the number of elements.

Expression trees enhance the evaluation of arithmetic expressions by organizing operations hierarchically according to their precedence, allowing efficient and orderly computation of nested arithmetic expressions. In an expression tree, each internal node represents an operator, and the leaves represent operands. This hierarchical structure simplifies the process of expression evaluation by utilizing tree traversals post-order (for post-fix evaluation) or in-order (for infix representation), ensuring that each operation is computed in the correct order. This structure minimizes parsing errors and improves clarity and maintainability over traditional linear parsing methods.

Open addressing and separate chaining are two collision resolution strategies in hash tables. Open addressing deals with collisions by probing through alternative locations in the table using a probe sequence until an empty slot is found, which tends to increase clustering but efficiently uses memory as no extra data structure is required. However, it suffers from primary and secondary clustering leading to decreased performance in inserts due to fewer available slots. In contrast, separate chaining uses linked lists to store all elements that hash to the same index, providing tolerance to high load factors and simple implementations. However, it requires additional memory for pointers and may result in non-constant time operations if chains become too long. Each method presents trade-offs between memory utilization versus operation speed.

B-trees and B+ trees are highly advantageous in database systems due to their structure, which maintains data sorted and allows efficient read and write operations. B-trees reduce the number of IO operations required to locate records by maintaining a balanced multi-level index, minimizing disk reads, which is critical in large databases. The B+ tree, an extension of the B-tree, further enhances performance by storing all record pointers at the leaf level, making range queries more efficient because records can be accessed sequentially without traversing the index again, allowing bulk read operations. This sorting and hierarchical structure maximizes data locality and access speed, making both trees ideal for database indexing.

Shell sort, known for its simplicity and efficiency in certain scenarios, suffers from limitations such as its worst-case time complexity of O(n^2) depending on shell's gap sequence. It lacks the theoretical efficiency and predictability of quicksort's average O(n log n) time complexity or mergesort's O(n log n) performance regardless of data distribution. Potential improvements involve optimizing the gap sequence—such as using Hibbard's increment or Sedgewick's sequence—to enhance efficiency. Despite its utility for moderate-sized arrays or when low overhead is beneficial, shell sort generally falls short in handling large sets of data as efficiently as more advanced algorithms like quicksort or mergesort.

Implementing extendible hashing in dynamic databases presents challenges such as efficiently managing growing and shrinking datasets while maintaining performance. This involves handling overflow buckets that can become costly to access due to increased levels of indirection. Solutions include using a directory-based system that scales with data, splitting buckets dynamically, and potentially using multiple hash functions to distribute keys more evenly. Extendible hashing also adapts well to changes in the database size by allowing the hash table to grow and shrink logarithmically in response to insertions and deletions, ensuring consistent average access time. However, maintaining directory limits and controlling bucket splitting amplitude require careful design to avoid high overhead.

Graph representations significantly impact the efficiency of traversal algorithms like Breadth-first Search (BFS) and Depth-first Search (DFS). Using an adjacency matrix allows O(1) time complexity to access adjacency information, making it beneficial for dense graphs where space is less of a concern. However, it requires O(V^2) space. An adjacency list is more space-efficient for sparse graphs, as it typically requires O(V+E) space, and allows BFS and DFS to operate with O(V+E) time complexity by navigating through connected nodes efficiently. Therefore, choosing between adjacency matrix and list representations impacts both space complexity and the effective runtime of these traversal algorithms, depending on graph density.

The role of balance in AVL trees is crucial as it maintains the height difference between the left and right subtrees of any node within a tolerance of -1, 0, or +1. This property ensures that the AVL trees remain balanced, thus guaranteeing O(log n) time complexity for insertion, deletion, and search operations. In contrast, unbalanced binary search trees can degrade into linked lists in the worst case, resulting in O(n) operations, making them inefficient for large datasets. The self-balancing nature of AVL trees improves performance in scenarios where frequent insertions or deletions are required, maintaining optimal data retrieval and manipulation times.

Priority queues enhance the functionality of scheduling algorithms in operating systems by allowing processes or tasks to be managed based on their priority levels, rather than the conventional first-come, first-served basis, optimizing resource allocation, and improving response times for critical tasks. They enable preemptive scheduling, where higher priority tasks can interrupt or preoccupy a running lower-priority task, ensuring crucial tasks are attended to promptly. Algorithms like priority-based Round Robin use priority queues to dynamically adjust the execution order, improving system efficiency, reducing idle CPU time, and ensuring higher priority tasks receive necessary resources without undue delay.

Circular queues differ from linear queues in that the rear of the queue is connected back to the front, forming a circular structure. This setup allows efficient utilization of storage space, as it can reuse empty spaces which are usually left unused in a linear queue as items get dequeued. Circular queues are especially useful in applications such as traffic simulation, buffers in routing tables for networked systems, and managing resource scheduling in time-shared systems where memory efficiency is crucial.

You might also like