Learn Python practically and Get Certified .

Popular Tutorials

Popular examples, reference materials, learn python interactively, learn ds & algorithms.

A computer program is a collection of instructions to perform a specific task. For this, a computer program may need to store data, retrieve data, and perform computations on the data.

A data structure is a named location that can be used to store and organize data. And, an algorithm is a collection of steps to solve a particular problem. Learning data structures and algorithms allow us to write efficient and optimized computer programs.

Our DSA tutorial will guide you to learn different types of data structures and algorithms and their implementations in Python, C, C++, and Java.

Do you want to learn DSA the right way? Enroll in our Interactive DSA Course for FREE.

  • Introduction

Data Structures (I)

Data structures (ii), tree based dsa (i), tree based dsa (ii), graph based dsa.

  • Sorting and Searching

Greedy Algorithms

  • Dynamic Programming

Other Algorithms

  • How to learn DSA?

DSA Introduction

  • What is an algorithm?
  • Data Structure and Types
  • Why learn algorithms?
  • Asymptotic Notations
  • Master Theorem
  • Divide and Conquer Algorithm
  • Types of Queue
  • Circular Queue
  • Priority Queue
  • Linked List
  • Linked List Operations
  • Types of Linked List
  • Heap Data Structure
  • Fibonacci Heap
  • Decrease Key and Delete node from Fibonacci Heap
  • Tree Data Structure
  • Tree Traversal
  • Binary Tree
  • Full Binary Tree
  • Perfect Binary Tree
  • Complete Binary Tree
  • Balanced Binary Tree
  • Binary Search Tree
  • Insertion into B-tree
  • Deletion from B-tree
  • Insertion on a B+ Tree
  • Deletion from a B+ Tree
  • Red Black Tree
  • Insertion in Red Black Tree
  • Deletion from Red Black Tree
  • Graph Data Structure
  • Spanning Tree
  • Strongly Connected Components
  • Adjacency Matrix
  • Adjacency List
  • DFS Algorithm
  • Breadth-first Search
  • Bellman Ford's Algorithm

Sorting and Searching Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Counting Sort
  • Bucket Sort
  • Linear Search
  • Binary Search
  • Greedy Algorithm
  • Ford-Fulkerson Algorithm
  • Dijkstra's Algorithm
  • Kruskal's Algorithm
  • Prim's Algorithm
  • Huffman Code
  • Floyd Warshall Algorithm
  • Longest Common Subsequence
  • Backtracking Algorithm
  • Rabin-Karp Algorithm

Why Learn DSA?

  • Write optimized and scalable code - Once you have knowledge about different data structures and algorithms, you can determine which data structure and algorithm to choose in various conditions.
  • Effective use of time and memory - Having knowledge about data structures and algorithms will help you write codes that run faster and require less storage.
  • Better job opportunities - Data structures and algorithms questions are frequently asked in job interviews of various organizations including Google, Facebook, and so on.

How you can learn data structure and algorithms?

Interactive dsa course.

Want to learn DSA with Python by solving quizzes and challenges after learning each concept? Enroll in our DSA Interactive Course for FREE.

Learn DSA from Programiz

Programiz offers a complete series of easy to follow DSA tutorials along with suitable examples. These tutorials are targeted for absolute beginners who want to dive into the field of computer programming.

Learn DSA from Books

Learning from books is always a good practice. You will get the big picture of programming concepts in the book which you may not find elsewhere.

Here are some books we personally recommend.

  • Introduction to Algorithms, Thomas H. Cormen - it is one of the best books in algorithms and covers a broad range of algorithms in-depth
  • Algorithms, Robert Sedgewick - it is the leading textbook on algorithms and is widely used in colleges and universities
  • The Art of Computer Programming, Donald E. Knuth - this book is considered best if you know the subject and are looking for deeper understanding

Learn DSA through visualization

Once you have some idea about data structure and algorithms, there is a great resource at Data Structure Visualizations that lets you learn through animation.

600.226: Data Structures (Spring 2017)

Assignment 4: stacking queues.

  • Out on: February 23, 2017
  • Due by: Thursday , March 2 before 10:00 pm
  • Collaboration: None
  • Grading: Packaging 10%, Style 10% (where applicable), Testing 10% (where applicable), Performance 10% (where applicable), Functionality 60% (where applicable)

The fourth assignment is mostly about stacks and queues. For the former you’ll build a simple calculator application, for the latter you’ll implement the data structure in a way that satisfies certain performance characteristics (in addition to the usual correctness properties).

Problem 1: Calculating Stacks (50%)

Your first task is to implement a basic RPN calculator that supports integer operands like 1 , 64738 , and -42 as well as the (binary) integer operators + , - , * , / , and % . The style of arithmetic expressions our calculator will evaluate is also called a post-fix notation. Stacks are great for doing this job! Your task is to write a driver (client) program that uses our Stack interface and one of the given implementations to perform these calculations as specified here.

Your program should be called Calc and work as follows:

  • The user enters input through System.in consisting of operands and operators, presumably in post-fix notation. We have also included some extra operators to get information about results and the current state of the stack.
  • If the user enters a valid integer, you push that integer onto the stack.
  • If the user enters a valid operator, you pop two integers off the stack, perform the requested operation, and push the result back onto the stack.
  • If the user enters the symbol ? (that’s a question mark), you print the current state of the stack using its toString method followed by a new line.
  • If the user enters the symbol ^ (that’s a caret), you pop the top element off the stack and print only that element (not the entire stack) followed by a new line.
  • If the user enters the symbol ! (that’s an exclamation mark or bang), you exit the program.

Note that there are a number of error conditions that your program must deal with gracefully for full credit. We’ll give you two examples for free, you’ll have to figure out any further error conditions for yourself:

  • If the user enters blah or 1.5 or anything else that doesn’t make sense for an integer calculator as specified above, your program should make it clear that it can’t do anything helpful with that input; but it should not stop at that point.
  • If the user requests an operation for which there are not enough operands on the stack, your program should notify the user of the problem but leave the stack unchanged; again, it should certainly not stop at that point.

Of course this means that you’ll have to print error messages to the user. Error messages must be printed to standard error and not to standard output! (Of course, the regular input and output is done through standard input and standard output as usual.) Furthermore, all error messages must start with the symbol # (that’s a hash sign) and be followed by a new line!

Here are two examples for interacting with Calc that will hopefully help you understand what you’re trying to achieve. First a “slow” example:

Here $ is the shell prompt. After starting the program, the first command was ? to print the stack (which is empty at this point, hence [] is the output). Then the user typed 10 followed by ? and we see that the stack now holds that number: [10] . Now the user typed two numbers 20 30 in sequence before hitting return. When we check the stack now using ? we get the answer [30, 20, 10] so obviously the “top” of the stack is to the left. Then we see the * operator being typed, which will multiply the top two numbers. We use ? again to check the result: [600, 10] . This is followed by the + operator, which will add the top two numbers. Again we check with ? and get [610] as we’d expect. The ^ command prints the same result 610 and pops if off the stack. So the next ? shows an empty stack again. Finally the user typed the ! command to quit, returning us to the shell. Here’s the same example, done “fast” this time:

As you can see, if the entire sequence of integers, operators, and commands is entered on a single line, they are all executed in order. It’s like having our own little programming language! Finally, here’s an example for the sample error conditions described above:

Note in particular that blah and 1.0 lead to error messages but are otherwise ignored (the program doesn’t stop); same for the two + operations when the stack only has a single element (the program doesn’t even modify the stack in that case).

Implementation Details and Hints

  • You must create an empty Stack to hold intermediate results and then repeatedly accept input from the user. It doesn’t matter whether you use the ArrayStack or the ListStack we provide, what does matter is that the specific type only appears once in your program. (In other words, the type of the stack reference variable you use in your program must be Stack and not ArrayStack or ListStack . Polymorphism!)
  • Note that we’re dealing with integers only (type Integer in Java) so / stands for integer division and % stands for integer remainder . Both of these should behave in Calc just like they do in Java. The details are messy but worth knowing about, especially regarding modulus .
  • You may find it interesting to read up on Autoboxing and Unboxing in Java. It’s the reason we can use our generic Stack implementations for Integer objects yet still do arithmetic like we would on regular int variables.
  • Only if you’re not afraid of learning on your own: You’ll be able to use the matches method of the String class to your advantage when it comes to checking whether a valid operator was entered. (But you can just as well do it with a bunch of separate comparisons or a simple String variable containing all the valid operation symbols if you don’t want to learn about regular expressions .)

Problem 2: Hacking Growable Deques (50%)

Your second task is to implement a generic ArrayDeque class as outlined in lecture. As is to be expected, ArrayDeque must implement the Deque interface we provided on Piazza .

Your implementation must be done in terms of an array that grows by doubling as needed. It’s up to you whether you want to use a built-in Java array or the SimpleArray class you know and love; just in case you prefer the latter, we’ve once again included it on the Piazza post for this assignment. Your initial array must have a length of one slot only! (Trust us, that’s going to make debugging the “doubling” part a lot easier.)

Your implemention must support all Deque operations except insertion in (worst-case) constant time ; insertion can take longer when you need to grow the array, but overall all insertion operations must be constant amortized time as discussed in lecture.

You should provide a toString method in addition to the methods required by the Deque interface. The toString will orient the front of the deque at the left and the back at the right. For example, a new dequeue into which 1, 2, and 3 were inserted using insertBack() should print as [1, 2, 3] whereas an empty dequeue should print as [] .

You must write JUnit 4 test drivers for the Deque interface and your ArrayDeque class. All the general test cases should go into DequeTestBase.java whereas test cases specific to ArrayDeque (if any!) should go into ArrayDequeTest.java . (Follow the example for testing the Array interface and its various implementations we posted on Piazza and discussed in lecture.)

Be sure to test all methods and all exceptions as well. Note that it is not enough to have just one test case for each method; there are plenty of complex interactions between the methods that need to be covered as well. (And yes, of course you need to test toString !)

Documentation

Don’t forget to add proper javadoc comments for your ArrayDeque class. Running checkstyle will remind you to do this!

General Assignment Hints

  • Ensure that the version of your code you hand in does not produce any extraneous debugging output anymore!
  • Pay attention to edge cases in the input your classes and programs are expected to handle! For example, make sure that you handle the empty input in a reasonable way for Problem 1.
  • Private helper methods are your friends. Your best friends, actually! If you don’t write plenty of them, you’ll have a much harder time getting your code to work.

Bonus Problem (0%)

Develop an algebraic specification for the abstract data type Queue . Use new , empty , enqueue , dequeue , and front (with the meaning of each as discussed in lecture) as your set of operations. Consider unbounded queues only, unless of course you want to do a bonus bonus problem on bounded queues as well.

The difficulty is going to be modelling the FIFO (first-in-first-out) behavior accurately. You’ll probably need at least one axiom with a case distinction using an if expression; the syntax for this in the Array specification for example.

Doing this problem without resorting to Google may be rather helpful for the upcoming midterm. There’s no need to submit the problem, but of course you can submit it if you wish; just include it at the end of your README file.

Deliverables

You must turn in a zipped ( .zip only) archive containing all source code, your README file, and any other deliverables required by the assignment. The filename should be HW##-jhed.zip with ## replaced by the 2-digit number (use leading 0s) of this assignment (see above) and jhed replaced by your Blackboard login. (For example, Peter would use HW03-pfroehl1.zip for his submission of Assignment 3.) The zip should contain no derived files whatsoever (i.e. no .class files, no .html files, etc.), but should allow building all derived files. Include a plain text README file (not README.txt or README.docx or whatnot) that briefly explains what your programs do and contains any other notes you want us to check out before grading. Your answers to written problems should be in this README file as well. Finally, make sure to include your name and email address in every file you turn in (well, in every file for which it makes sense to do so anyway)!

For reference, here is a short explanation of the grading criteria; some of the criteria don't apply to all problems, and not all of the criteria are used on all assignments.

Packaging refers to the proper organization of the stuff you hand in, following both the guidelines for Deliverables above as well as the general submission instructions for assignments.

Style refers to Java programming style, including things like consistent indentation, appropriate identifier names, useful comments, suitable javadoc documentation, etc. Many aspects of this are enforced automatically by Checkstyle when run with the configuration file available on Piazza . Style also includes proper modularization of your code (into interfaces, classes, methods, using public , protected , and private appropriately, etc.). Simple, clean, readable code is what you should be aiming for.

Testing refers to proper unit tests for all of the data structure classes you developed for this assignment, using the JUnit 4 framework as introduced in lecture. Make sure you test all (implied) axioms that you can think of and all exception conditions that are relevant.

Performance refers to how fast/with how little memory your program can produce the required results compared to other submissions.

Functionality refers to your programs being able to do what they should according to the specification given above; if the specification is ambiguous and you had to make a certain choice, defend that choice in your README file.

If your programs cannot be built you will get no points whatsoever. If your programs cannot be built without warnings using javac -Xlint:all we will take off 10% (except if you document a very good reason; no, you cannot use the @SuppressWarnings annotation either). If your programs fail miserably even once, i.e. terminate with an exception of any kind, we will take off 10% (however we'll also take those 10% off if you're trying to be "excessively smart" by wrapping your whole program into a universal try-catch).

Browse Course Material

Course info, instructors.

  • Kyle Murray

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Programming Languages
  • Software Design and Engineering

Learning Resource Types

Introduction to c and c++, data structures, debugging.

Topics: Using structs, unions, typedef, and enums, and how to debug with Valgrind and GDB.

Lecture Notes

Lecture 4: Data Structures, Debugging (PDF)

Lab Exercises

The primary goal of this lab period is to introduce debugging tools, and use of unions/structs.

Download and install Valgrind on your system, if it’s not already. To test if you have Valgrind, run valgrind --version . It should print the version of Valgrind that is installed.

There are 3 sources of memory errors in this code. Run valgrind to determine what they are (although I suspect you can probably tell from the code anyways).

Use a union to print the individual bytes of an int . (Hint: Recall the size of int s and other data types.)

Determine how much memory is required for each of the struct s below. How much of that memory is padding between the members?

Assignment 4

Today’s assignment combines the material from the past few lectures. Your job is to fill in the skeleton code we provide. I have commented the code with what each section should do.

Assignment 4 files (ZIP) (This ZIP file conatins: 2 .c files and 1 .h file.)

You can learn more about binary search trees and find pseudo-code on the binary search tree page on Wikipedia .

Your job is to implement a binary search tree, a data structure of connected nodes with a tree shape. Each node has a node identifier (a number), data (payload), and 2 children (left and right). The children are other nodes referenced with a pointer, with the constraint that the left node’s ID is less than the parent node’s ID, and the right node’s ID is larger than the parent node ID. No two nodes will have the same identifier. A node can have less than two children; in that case, one or more of its child pointers can be NULL .

A binary search tree with four nodes. In this diagram, each node is represented by boxes labeled ID, Payload, Left, and Right.

Image by MIT OpenCourseWare.

user.c contains the main() function. We will replace this function with one for grading. You should use your main() function to test that your functions to insert into and search the binary tree work correctly.

This is a C/C++ course, not an algorithms course, but if you want a challenge, try implementing node deletion as well!

Your job is to complete the data structure and function declarations in bintree.h , then complete the implementation of your functions in bintree.c . If you want to define additional functions to simplify your program, that’s fine. You cannot change the return types or argument types of the included functions, though. Even though we don’t require the deletion function, make sure to free all memory you allocate!

Make sure your program compiles without warning, runs, and definitely use valgrind to ensure you have no memory leaks.

Solutions are not available for this assignment.

facebook

You are leaving MIT OpenCourseWare

Data Structures Lab (2-1-1)

SPRING 2022-2023

Lectures/ Tut and Lab evaluation will be held physically

Announcements, Assignment submissions via Google Classroom

Course Objective:

Course Outline:

Tools and Language

Linux Distribution

Working in the Windows environment

1.       Ellis Horowitz, Satraj Sahni and Susan Anderson-Freed, Fundamentals of Data Structures in C, W. H. Freeman and Company.

2.       Seymour Lipschutz , Data Structures, Schaum's Outlines Series, Tata McGraw-Hill.

References:

4.       R. G. Dromey, How to Solve it by Computer, Prentice-Hall of India. .

5.       PDS notes @IIT KGP

Important Instructions:

1.          The lab classes will mainly consist of implementation of programming concepts discussed in class and the assignments covered in tutorial sessions. of the course website for details. .

2.          Every student is expected to have access to at least one of the text books .

3.          Attendance in the classes is mandatory. If the attendance of a student falls below 75%, he/she may will be dropped from the course after Component 2

4.          The course will consist of laboratory and take-home assignments, which has to be done very seriously. If a student does not submit the assignments, his/her grade will remain as incomplete .

5.          The vehicular language for the course will be "C". All codes, assignments and lab exercises will be implemented in C language only. .

6.          The laboratory assignments will be mainly implementation-oriented which have to coded in C and will be based the topics discussed in theoretical lectures.

7.          Grading Policy :

o    Component 1 -Lab assignments and a lab test will form the 10% of this component.

o    Component 2 - Lab assignments and lab test will form the 10% of this component.

o    Component 3 - Group Project evalution

Lab Related Instructions:

1. Submission : All submissions must be made using Google Classroom . You will be notified about mode and way to submit in the tutorial classes. E-mail submission is strongly discouraged and if submitted will be ignored.   Submissions after the deadline will not be considered.

2. Programming Language : All programs must be written in the C programming language. algorithms. Although we will initially help you to debug your codes, the debugging support will be slowly withdrawn as time progresses. For C syntax, look at the lecture slides, or bring with you any textbook on ANSI C.

3. Plagiarism :   We have a zero tolerance policy towards plagiarism. Any case of cheating or stealing codes would result in imposition of “ Unfair Means “ charge on you and you will have to face the disciplinary committee of the Department leading to probable de-registration from the course. The person who allowed his program to be copied and the one who copied it will face same consequences.   If you copy parts of your code from the Internet, you must mention that clearly in your code. Failure to do that will lead to your entire submission being invalid.  

4. Comments and Indentation : We want your programs to follow a proper indentation style as instructed in the lab

  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial

Data Structures Tutorial

  • Introduction to Data Structures
  • Data Structure Types, Classifications and Applications

Overview of Data Structures

  • Introduction to Linear Data Structures
  • Introduction to Hierarchical Data Structure
  • Overview of Graph, Trie, Segment Tree and Suffix Tree Data Structures

Different Types of Data Structures

  • Array Data Structure
  • String in Data Structure
  • Linked List Data Structure
  • Stack Data Structure
  • Queue Data Structure
  • Introduction to Tree - Data Structure and Algorithm Tutorials
  • Heap Data Structure
  • Hashing in Data Structure
  • Graph Data Structure And Algorithms
  • Matrix Data Structure
  • Advanced Data Structures
  • Data Structure Alignment : How data is arranged and accessed in Computer Memory?
  • Static Data Structure vs Dynamic Data Structure
  • Static and Dynamic data structures in Java with Examples
  • Common operations on various Data Structures
  • Real-life Applications of Data Structures and Algorithms (DSA)

Different Types of Advanced Data Structures

Data structures  are essential components that help organize and store data efficiently in computer memory. They provide a way to manage and manipulate data effectively, enabling faster access, insertion, and deletion operations.

Common data structures include  arrays, linked lists, stacks, queues, trees, and graphs  , each serving specific purposes based on the requirements of the problem. Understanding data structures is fundamental for designing efficient algorithms and optimizing software performance.

data structure lab assignment

Data Structure

Table of Content

What is a Data Structure?

Why are data structures important, classification of data structures, types of data structures, applications of data structures.

  • Learn Basics of Data Structure
  • Most Popular Data Structures
  • Advanced Data Structure

A data structure is a way of organizing and storing data in a computer so that it can be accessed and used efficiently. It defines the relationship between the data and the operations that can be performed on the data

Data structures are essential for the following reasons:

  • Efficient Data Management: They enable efficient storage and retrieval of data, reducing processing time and improving performance.
  • Data Organization: They organize data in a logical manner, making it easier to understand and access.
  • Data Abstraction: They hide the implementation details of data storage, allowing programmers to focus on the logical aspects of data manipulation.
  • Reusability: Common data structures can be reused in multiple applications, saving time and effort in development.
  • Algorithm Optimization: The choice of the appropriate data structure can significantly impact the efficiency of algorithms that operate on the data.

Data structures can be classified into two main categories:

  • Linear Data Structures: These structures store data in a sequential order this allowing for easy insertion and deletion operations. Examples include arrays, linked lists, and queues.
  • Non-Linear Data Structures: These structures store data in a hierarchical or interconnected manner this allowing for more complex relationships between data elements. Examples include trees, graphs, and hash tables.

Basically, data structures are divided into two categories:

Linear Data Structures:

  • Array: A collection of elements of the same type stored in contiguous memory locations.
  • Linked List: A collection of elements linked together by pointers, allowing for dynamic insertion and deletion.
  • Queue: A First-In-First-Out (FIFO) structure where elements are added at the end and removed from the beginning.
  • Stack: A Last-In-First-Out (LIFO) structure where elements are added and removed from the top.

Non-Linear Data Structures:

  • Tree: A hierarchical structure where each node can have multiple child nodes.
  • Graph: A collection of nodes connected by edges, representing relationships between data elements.
  • Hash Table: A data structure that uses a hash function to map keys to values, allowing for fast lookup and insertion.

Data structures are widely used in various applications, including:

  • Database Management Systems: To store and manage large amounts of structured data.
  • Operating Systems: To manage memory, processes, and files.
  • Compiler Design: To represent source code and intermediate code.
  • Artificial Intelligence: To represent knowledge and perform reasoning.
  • Graphics and Multimedia: To store and process images, videos, and audio data.

Learn Basics of Data Structure:

  • Overview of Data Structures | Set 3 (Graph, Trie, Segment Tree and Suffix Tree)
  • Abstract Data Types

Most Popular Data Structures :

Below are some most popular Data Structure:

Array is a linear data structure that stores a collection of elements of the same data type. Elements are allocated contiguous memory, allowing for constant-time access. Each element has a unique index number.

Important articles on Array:

  • Search, insert and delete in an unsorted array
  • Search, insert and delete in a sorted array
  • Write a program to reverse an array
  • Leaders in an array
  • Given an array A[] and a number x, check for pair in A[] with sum as x
  • Majority Element
  • Find the Number Occurring Odd Number of Times
  • Largest Sum Contiguous Subarray
  • Find the Missing Number
  • Search an element in a sorted and pivoted array
  • Merge an array of size n into another array of size m+n
  • Median of two sorted arrays
  • Program for array rotation
  • Reversal algorithm for array rotation
  • Block swap algorithm for array rotation
  • Maximum sum such that no two elements are adjacent
  • Sort elements by frequency | Set 1
  • Count Inversions in an array

Related articles on Array:

  • All Articles on Array
  • Coding Practice on Array
  • Quiz on Array
  • Recent Articles on Array

A matrix is a two-dimensional array of elements, arranged in rows and columns. It is represented as a rectangular grid, with each element at the intersection of a row and column.

Important articles on Matrix:

  • Search in a row wise and column wise sorted matrix
  • Print a given matrix in spiral form
  • A Boolean Matrix Question
  • Print unique rows in a given boolean matrix
  • Maximum size square sub-matrix with all 1s
  • Inplace M x N size matrix transpose | Updated
  • Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)
  • Strassen’s Matrix Multiplication
  • Create a matrix with alternating rectangles of O and X
  • Print all elements in sorted order from row and column wise sorted matrix
  • Given an n x n square matrix, find sum of all sub-squares of size k x k
  • Count number of islands where every island is row-wise and column-wise separated
  • Find a common element in all rows of a given row-wise sorted matrix

Related articles on Matrix:

  • All Articles on Matrix
  • Coding Practice on Matrix
  • Recent Articles on Matrix.

3. Linked List:

A linear data structure where elements are stored in nodes linked together by pointers. Each node contains the data and a pointer to the next node in the list. Linked lists are efficient for inserting and deleting elements, but they can be slower for accessing elements than arrays.

Types of Linked List:

a) Singly Linked List: Each node points to the next node in the list.

Important articles on Singly Linked Lis:

  • Introduction to Linked List
  • Linked List vs Array
  • Linked List Insertion
  • Linked List Deletion (Deleting a given key)
  • Linked List Deletion (Deleting a key at given position)
  • A Programmer’s approach of looking at Array vs. Linked List
  • Find Length of a Linked List (Iterative and Recursive)
  • How to write C functions that modify head pointer of a Linked List?
  • Swap nodes in a linked list without swapping data
  • Reverse a linked list
  • Merge two sorted linked lists
  • Merge Sort for Linked Lists
  • Reverse a Linked List in groups of given size
  • Detect and Remove Loop in a Linked List
  • Add two numbers represented by linked lists | Set 1
  • Rotate a Linked List
  • Generic Linked List in C

b) Circular Linked List: The last node points back to the first node, forming a circular loop.

Important articles on Circular Linked List:

  • Circular Linked List Introduction and Applications,
  • Circular Singly Linked List Insertion
  • Circular Linked List Traversal
  • Split a Circular Linked List into two halves
  • Sorted insert for circular linked list

c) Doubly Linked List: Each node points to both the next and previous nodes in the list.

Important articles on Doubly Linked List:

  • Doubly Linked List Introduction and Insertion
  • Delete a node in a Doubly Linked List
  • Reverse a Doubly Linked List
  • The Great Tree-List Recursion Problem.
  • QuickSort on Doubly Linked List
  • Merge Sort for Doubly Linked List

Related articles on Linked List:

  • All Articles of Linked List
  • Coding Practice on Linked List
  • Recent Articles on Linked List

Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out) . LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first, comes out last.

Important articles on Stack:

  • Introduction to Stack
  • Infix to Postfix Conversion using Stack
  • Evaluation of Postfix Expression
  • Reverse a String using Stack
  • Implement two stacks in an array
  • Check for balanced parentheses in an expression
  • Next Greater Element
  • Reverse a stack using recursion
  • Sort a stack using recursion
  • The Stock Span Problem
  • Design and Implement Special Stack Data Structure
  • Implement Stack using Queues
  • Design a stack with operations on middle element
  • How to efficiently implement k stacks in a single array?

Related articles on Stack:

  • All Articles on Stack
  • Coding Practice on Stack
  • Recent Articles on Stack

A Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of “First in, First out ” ( FIFO ), where the first element added to the queue is the first one to be removed

Important articles on Queue:

  • Queue Introduction and Array Implementation
  • Linked List Implementation of Queue
  • Applications of Queue Data Structure
  • Priority Queue Introduction
  • Deque (Introduction and Applications)
  • Implementation of Deque using circular array
  • Implement Queue using Stacks
  • Find the first circular tour that visits all petrol pumps
  • Maximum of all subarrays of size k
  • An Interesting Method to Generate Binary Numbers from 1 to n
  • How to efficiently implement k Queues in a single array?

Related articles on Queue:

  • All Articles on Queue
  • Coding Practice on Queue
  • Recent Articles on Queue

6. Binary Tree:

Binary Tree is a hierarchical data structure where each node has at most two child nodes, referred to as the left child and the right child. Binary trees are mostly used to represent hierarchical data, such as file systems or family trees.

Important articles on Binary Tree:

  • Binary Tree Introduction
  • Binary Tree Properties
  • Types of Binary Tree
  • Handshaking Lemma and Interesting Tree Properties
  • Enumeration of Binary Tree
  • Applications of tree data structure
  • Tree Traversals
  • BFS vs DFS for Binary Tree
  • Level Order Tree Traversal
  • Diameter of a Binary Tree
  • Inorder Tree Traversal without Recursion
  • Inorder Tree Traversal without recursion and without stack!
  • Threaded Binary Tree
  • Maximum Depth or Height of a Tree
  • If you are given two traversal sequences, can you construct the binary tree?
  • Clone a Binary Tree with Random Pointers
  • Construct Tree from given Inorder and Preorder traversals
  • Maximum width of a binary tree
  • Print nodes at k distance from root
  • Print Ancestors of a given node in Binary Tree
  • Check if a binary tree is subtree of another binary tree
  • Connect nodes at same level

Related articles on Binary Tree:

  • All articles on Binary Tree
  • Coding Practice on Binary Tree
  • Recent Articles on Tree

7. Binary Search Tree:

A Binary Search Tree is a data structure used for storing data in a sorted manner. Each node in a Binary Search Tree has at most two children, a left child and a right child, with the left child containing values less than the parent node and the right child containing values greater than the parent node. This hierarchical structure allows for efficient searching, insertion, and deletion operations on the data stored in the tree.

Important articles on Binary Search Tree:

  • Search and Insert in BST
  • Deletion from BST
  • Minimum value in a Binary Search Tree
  • Inorder predecessor and successor for a given key in BST
  • Check if a binary tree is BST or not
  • Lowest Common Ancestor in a Binary Search Tree.
  • Inorder Successor in Binary Search Tree
  • Find k-th smallest element in BST (Order Statistics in BST)
  • Merge two BSTs with limited extra space
  • Two nodes of a BST are swapped, correct the BST
  • Floor and Ceil from a BST
  • In-place conversion of Sorted DLL to Balanced BST
  • Find a pair with given sum in a Balanced BST
  • Total number of possible Binary Search Trees with n keys
  • Merge Two Balanced Binary Search Trees
  • Binary Tree to Binary Search Tree Conversion

Related articles on Binary Search Tree:

  • All Articles on Binary Search Tree
  • Coding Practice on Binary Search Tree
  • Recent Articles on BST

A Heap is a complete binary tree data structure that satisfies the heap property: for every node, the value of its children is less than or equal to its own value. Heaps are usually used to implement priority queues , where the smallest (or largest) element is always at the root of the tree.

Important articles on Heap:

  • Binary Heap
  • Why is Binary Heap Preferred over BST for Priority Queue?
  • K’th Largest Element in an array
  • Sort an almost sorted array
  • Binomial Heap
  • Fibonacci Heap
  • Tournament Tree (Winner Tree) and Binary Heap

Related articles on Heap:

  • All Articles on Heap
  • Coding Practice on Heap
  • Recent Articles on Heap

9. Hashing:

Hashing  is a technique that generates a fixed-size output (hash value) from an input of variable size using mathematical formulas called  hash functions . Hashing is used to determine an index or location for storing an item in a data structure, allowing for efficient retrieval and insertion.

Important articles on Hashing:

  • Hashing Introduction
  • Separate Chaining for Collision Handling
  • Open Addressing for Collision Handling
  • Print a Binary Tree in Vertical Order
  • Find whether an array is subset of another array
  • Union and Intersection of two Linked Lists
  • Find a pair with given sum
  • Check if a given array contains duplicate elements within k distance from each other
  • Find Itinerary from a given list of tickets
  • Find number of Employees Under every Employee

Related articles on Hashing:

  • All Articles on Hashing
  • Coding Practice on Hashing
  • Recent Articles on Hashing

Graph is a collection of nodes connected by edges. Graphs are mostly used to represent networks, such as social networks or transportation networks.

Important articles on Graph:

  • Graph and its representations
  • Breadth First Traversal for a Graph
  • Depth First Traversal for a Graph
  • Applications of Depth First Search
  • Applications of Breadth First Traversal
  • Detect Cycle in a Directed Graph
  • Detect Cycle in Graph using DSU
  • Detect cycle in an Undirected Graph using DFS
  • Longest Path in a Directed Acyclic Graph
  • Topological Sorting
  • Check whether a given graph is Bipartite or not
  • Snake and Ladder Problem
  • Minimize Cash Flow among a given set of friends who have borrowed money from each other
  • Boggle (Find all possible words in a board of characters)
  • Assign directions to edges so that the directed graph remains acyclic

Related articles on Graph:

  • All Articles on Graph Data Structure
  • Coding Practice on Graph
  • Recent Articles on Graph

Advanced Data Structure:

Below are some advance Data Structure:

1. Advanced Lists:

Advanced Lists is a data structure that extends the functionality of a standard list. Advanced lists may support additional operations, such as finding the minimum or maximum element in the list, or rotating the list.

Important articles on Advanced Lists:

  • Memory efficient doubly linked list
  • XOR Linked List – A Memory Efficient Doubly Linked List | Set 1
  • XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
  • Skip List | Set 1 (Introduction)
  • Self Organizing List | Set 1 (Introduction)
  • Unrolled Linked List | Set 1 (Introduction)

2. Segment Tree:

Segment Tree is a tree data structure that allows for efficient range queries on an array. Each node in the segment tree represents a range of elements in the array, and the value stored in the node is some aggregate value of the elements in that range.

Important articles on Segment Tree:

  • Segment Tree | Set 1 (Sum of given range)
  • Segment Tree | Set 2 (Range Minimum Query)
  • Lazy Propagation in Segment Tree
  • Persistent Segment Tree | Set 1 (Introduction)

Related articles on Segment Tree:

  • All articles on Segment Tree

Trie is a tree-like data structure that is used to store strings. Each node in the trie represents a prefix of a string, and the children of a node represent the different characters that can follow that prefix. Tries are often used for efficient string matching and searching.

Important articles on Trie:

  • Trie | (Insert and Search)
  • Trie | (Delete)
  • Longest prefix matching – A Trie based solution in Java
  • How to Implement Reverse DNS Look Up Cache?
  • How to Implement Forward DNS Look Up Cache?

Related articles on Trie :

  • All Articles on Trie

4. Binary Indexed Tree:

Binary Indexed Tree is a data structure that allows for efficient range queries and updates on an array. Binary indexed trees are often used to compute prefix sums or to solve range query problems.

Important articles on Binary Indexed Tree:

  • Binary Indexed Tree
  • Two Dimensional Binary Indexed Tree or Fenwick Tree
  • Binary Indexed Tree : Range Updates and Point Queries
  • Binary Indexed Tree : Range Update and Range Queries

Related articles on Binary Indexed Tree :

  • All Articles on Binary Indexed Tree

5. Suffix Array and Suffix Tree :

Suffix Array and Suffix Tree is a data structures that are used to efficiently search for patterns within a string. Suffix arrays and suffix trees are mostly used in bioinformatics and text processing applications.

Important articles on Suffix Array and Suffix Tree:

  • Suffix Array Introduction
  • Suffix Array nLogn Algorithm
  • kasai’s Algorithm for Construction of LCP array from Suffix Array
  • Suffix Tree Introduction
  • Ukkonen’s Suffix Tree Construction – Part 1
  • Ukkonen’s Suffix Tree Construction – Part 2
  • Ukkonen’s Suffix Tree Construction – Part 3
  • Ukkonen’s Suffix Tree Construction – Part 4,
  • Ukkonen’s Suffix Tree Construction – Part 5
  • Ukkonen’s Suffix Tree Construction – Part 6
  • Generalized Suffix Tree
  • Build Linear Time Suffix Array using Suffix Tree
  • Substring Check
  • Searching All Patterns
  • Longest Repeated Substring,
  • Longest Common Substring, Longest Palindromic Substring

Related articles on Suffix Array and Suffix Tree:

  • All Articles on Suffix Tree

6. AVL Tree:

AVL tree is a self-balancing binary search tree that maintains a balanced height. AVL trees are mostly used when it is important to have efficient search and insertion operations.

Important articles on AVL Tree:

  • AVL Tree | Set 1 (Insertion)
  • AVL Tree | Set 2 (Deletion)
  • AVL with duplicate keys

7. Splay Tree:

Splay Tree is a self-balancing binary search tree that moves frequently accessed nodes to the root of the tree. Splay trees are mostly used when it is important to have fast access to recently accessed data.

Important articles on Splay Tree:

  • Splay Tree | Set 1 (Search)
  • Splay Tree | Set 2 (Insert)

B Tree is a balanced tree data structure that is used to store data on disk. B trees are mostly used in database systems to efficiently store and retrieve large amounts of data.

Important articles on B Tree:

  • B-Tree | Set 1 (Introduction)
  • B-Tree | Set 2 (Insert)
  • B-Tree | Set 3 (Delete)

9. Red-Black Tree:

Red-Black Tree is a self-balancing binary search tree that maintains a balance between the number of black and red nodes. Red-black trees are mostly used when it is important to have efficient search and insertion operations.

Important articles on Red-Black Tree:

  • Red-Black Tree Introduction
  • Red Black Tree Insertion.
  • Red-Black Tree Deletion
  • Program for Red Black Tree Insertion

Related articles on Red-Black Tree:

  • All Articles on Self-Balancing BSTs

10. K Dimensional Tree:

K Dimensional Tree is a tree data structure that is used to store data in a multidimensional space. K dimensional trees are mostly used for efficient range queries and nearest neighbor searches.

Important articles on K Dimensional Tree:

  • KD Tree (Search and Insert)
  • K D Tree (Find Minimum)
  • K D Tree (Delete)

Others Data Structure:

  • Treap (A Randomized Binary Search Tree)
  • Ternary Search Tree
  • Interval Tree
  • Implement LRU Cache
  • Sort numbers stored on different machines
  • Find the k most frequent words from a file
  • Given a sequence of words, print all anagrams together
  • Decision Trees – Fake (Counterfeit) Coin Puzzle (12 Coin Puzzle)
  • Spaghetti Stack
  • Data Structure for Dictionary and Spell Checker?
  • Cartesian Tree
  • Cartesian Tree Sorting
  • Centroid Decomposition of Tree
  • Gomory-Hu Tree
  • Recent Articles on Advanced Data Structures.
  • Commonly Asked Data Structure Interview Questions | Set 1
  • A data structure for n elements and O(1) operations
  • Expression Tree

Please Login to comment...

Related articles.

advertisewithusBannerImg

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

CptS 122 – Data Structures                                                                          

Lab 6: Data Structures and Dynamic Binary Search Trees (BSTs) in C

Assigned: Week of October 1, 2012

Due: At the end of the lab session

I. Learner Objectives:

At the conclusion of this programming assignment, participants should be able to:

  •   Design, implement and test a dynamic BST in C
  • Compare and contrast dynamic linked lists, dynamic stacks, dynamic BSTs, and dynamic BSTs
  • Summarize the advantages of applying a BST within certain applications
  • Describe the operations applied to a BST including

1.       insertNode ( )

2.       deleteNode ( )

3.       inOrder ( )

4.       preOrder ( )

5.       postOrder ( )

II. Prerequisites:

Before starting this programming assignment, participants should be able to:

  • Analyze a basic set of requirements for a problem
  • Compose a small C language program
  • Create test cases for a program
  • Apply and implement structs in C
  • Apply and implement pointers in C
  • Apply and implement dynamic memory in C
  • Design and implement a dynamic singly linked list
  • Design and implement a dynamic stack
  • Design and implement a dynamic queue

III . Overview & Requirements:

This lab, along with your TA, will help you navigate through designing, implementing, and testing a dynamic BST. Recall, a BST data structure is a nonlinear, two-dimensional data structure. A BST is traversed by starting at the root pointer. The root node is the first node inserted into the tree. Nodes are inserted into the tree such that all items to the left of the root node are less than, and all items to the right of the root are greater than its item. Also, this property holds true for any particular node in the tree. We will visualize a BST in the following way:

data structure lab assignment

Labs are held in a “closed” environment such that you may ask your TA questions. Please use your TAs knowledge to your advantage. You are required to move at the pace set forth by your TA. Please help other students in need when you are finished with a task. You may work in pairs if you wish. However, I encourage you to compose your own solution to each problem. Have a great time! Labs are a vital part to your education in CptS 122 so work diligently.

1. Command line arguments and file I/O (another review exercise!)

Implement a main program that will read, from the command line, the name of the file containing the English text to convert to Morse code. At this point, just read from the test file and print it to the screen to be sure that you are reading the text correctly. You should be using the fgets ( ) function for input and fputs ( ) or puts ( ) for output to the screen.

2. Defining the BSTNode structure               

Create a structure for the BSTNode data that will have as its members a character and a character array of size 10. The character will hold the English text character, and the array will hold a string that represents the corresponding Morse characters for that English text character. You also need to define left and right child pointers that point to BSTNode structures.

3. Create the BST code and create a Morse lookup BST

You should be able to read in the Morse table from a file. You will have to rearrange the Morse table in the file to make sure that your lookup tree is balanced. (Think about the order of insertions).

Morse Code Alphabet :

As you defined in Task 2, each BSTNode will have the data for the English text characters and Morse code, and both left and right child pointers. You will need to create an insert ( ) function to fill the tree with each letter/Morse structure. You should arrange the tree so that it is alphabetically ordered from left to right. Also create a print ( ) function that uses recursion to traverse the tree in order (left most printed first). Finally build a search ( ) function that will return the Morse code for each English character searched for. Do you need to return a found indicator from the search function? Should you use recursion?

Also, you should be able to print a diagram of your tree as items are inserted into it!

4. Putting the pieces together

Putting it all together, you will read in a file on the command line, look for each English letter with a search ( ) function on the BST, and print the Morse code for that letter. For each character in the test file, convert the character to a Morse code string. Each Morse character will be separated by a space. Each complete Morse string will be separated by three spaces. Each newline character will be echoed to the screen. The final output should be the FULLSTOP string.   Note: you should convert any lowercase English characters to uppercase before processing the English text.

You can create several small files to test your program or you may try the following:

This is a test of the cpts 122

Morse code conversion tool.

abc def ghi jkl mno pqr stu vwx yz0 123 456 789

thanks for your attention

- .... .. ...   .. ...   .-   - . ... -   --- ..-.   - .... .   -.-. .--. - ...   .---- ..--- ..--- 

-- --- .-. ... .   -.-. --- -.. .   -.-. --- -. ...- . .-. ... .. --- -.   - --- --- .-.. .-.-.-   

.- -... -.-.   -.. . ..-.   --. .... ..   .--- -.- .-..   -- -. ---   .--. --.- .-.   ... - ..-   ...- .-- -..

IV. Submitting Labs:

  •   You are not required to submit your lab solutions. However, you should keep them in a folder that you may continue to access throughout the semester. You should not store your solutions to the local C: drive on the Sloan 353 machines. These files are erased on a daily basis.

V. Grading Guidelines:

  • This lab is worth 100 points. Your lab grade is assigned based on completeness and effort.  To receive full credit for the lab you must show up on time

and continue to work on the problems  and complete all the problems until the TA has dismissed you.

Archived Content

Perplexing puzzles.

Solo MP This MP, as well as all other MPs in CS 225, are to be completed without a partner.

You are welcome to get help on the MP from course staff, via open lab hours, or Piazza!

Goals and Overview

In this MP, you will:

  • Work with a graph that is to large too store completely in memory
  • Use a graph algorithm to solve a complex problem
  • Implement an algorithm from public sources documents
  • See the difference in performance between a guided and unguided search algorithm

Checking Out the Code

All assignments will be distributed via our release repo on github this semester. You will need to have set up your git directory to have our release as a remote repo as described in our git set up

You can merge the assignments as they are released into your personal repo with

if you are using multiple machines you may need to use the following to allow them to work correcly.

The first git command will fetch and merge changes from the main branch on your remote repository named release into your personal. The --no-edit flag automatically generates a commit message for you, and the --no-rebase flag will merge the upstream branch into the current branch. Generally, these two flags shouldn’t be used, but are included for ease of merging assignments into your repo.

The second command will push to origin (your personal), which will allow it to track the new changes from release .

You will need to run these commands for every assignment that is released.

All the files for this mp are in the mp_puzzle directory.

Preparing Your Code

This semester for MPs we are using CMake rather than just make. This allows for us to use libraries such as Catch2 that can be installed in your system rather than providing them with each assignment. This change does mean that for each assignment you need to use CMake to build your own custom makefiles. To do this you need to run the following in the base directory of the assignment. Which in this assignment is the mp_puzzle directory.

This first makes a new directory in your assignment directory called build . This is where you will actually build the assignment and then moves to that directory. This is not included in the provided code since we are following industry standard practices and you would normally exclude the build directory from any source control system.

Now you need to actually run CMake as follows.

This runs CMake to initialize the current directory which is the build directory you just made as the location to build the assignment. The one argument to CMake here is .. which referes to the parent of the current directory which in this case is top of the assignment. This directory has the files CMake needs to setup your assignment to be build.

At this point you can in the build directory run make as described to build the various programs for the MP.

You will need to do the above once for each assignment. You will need to run make every time you change source code and want to compile it again.

Assignment Description

data structure lab assignment

In this mp we will be developing a puzzle solver for 15 puzzle as a graph problem. If you have not heard of 15 puzzle before you may want to look at the wikipedia article on it here . We will then generate an animation of the solution.

Part 1: The PuzzleState data structure

In the first part of this assignment we will work on representing the puzzle as a graph. To do this we will have a node for every possible position of the puzzle and an edge between two nodes if there is a single move of a tile that will move from one position to the next. The tricky part in this is that there are 16 factorial possible positions for the puzzle. Since this is way too large to store in memory we will need to only use the portions of the graph that we need to get from the starting position until we can find a solution.

To do this we will build a class PuzzleState that stores a single vertex of the graph but can also create its neighbors when asked. This is not hard to do since the possible positions you can move to are easy to compute only knowing the current position. This will give you a system where you only need to create the nodes of the graph when you explore them. You will need to implement all the methods in the PuzzleState class.

Creating and Outputing

While the internal implementation of the PuzzleState class is entirely up to you we are defining two functions to make sure that we agree on what state we are referring to. These functions are the Constructor that takes an array of positions and creates a PuzzleState with those positions and asArray which returns the array version of that state. The format of this is to list the values in the puzzle starting for the upper left hand corner and moving to the right until the end of the line then moving to the next line until all 16 positions are provided.

Implementing operator<

To ensure that you can use std::map to store PuzzleStates we require you to implement an operator<() . While this operator does not represent any real relation between the different puzzle states it will satisfy the requirement for a total order so that you can use std::map .

Manhattan Distance

One function that might be unclear is the manhattanDistance function. This is asking you to compute a distance value between two states. This distance is the distance that each tile has to travel in the x dimension and the y dimension to reach the location of the tile in the other state.

Testing Your Code

Provided Catch test cases are available as well by running:

Extra Credit Submission

For extra credit, you can submit the code you have implemented and tested for part one of mp_puzzle. You must submit your work before the extra credit deadline as listed at the top of this page. See Handing in Your Code for instructions.

Part 2: The Solve Functions

In part 2 we are writing two different functions that will each solve the puzzle by finding the shortest path from the start state to the goal state. If the goal is not stated, the standard solved state will be used. The first version will solve this by implementing breadth first search. The second will use the A* algorithm. The doxygen of these functions can be seen here solveBFS and solveAstar .

A* search Algorithm

The A* algorithm is an algorithm for finding the shortest path from one point in a graph to another point in the graph. Documentation on the general algorithm can be found on wikipedia here . You should use the material provided there as the basis for your implementation. The key idea here is that A* uses a heuristic function to estimate how much further a state is from the goal state. In our case we will be using the manhattan distance function we wrote in part 1. This works since each move in the puzzle moves a single piece in a single direction so the minimum distance from a state to the goal state is enough moves to move each piece directly there.

Handing in your code

You must submit your work on PL for grading. We will use the following files for grading:

All other files will not be used for grading.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

THIS REPO CONTAINS ALL THE DATA STRUCTURES LAB ASSIGNMENTS OF THE SPPU SECOND YEAR COMPUTER AND AI&DS 2019 PATTERN SYLLABUS. USE THIS FOR REFERENCE. STAR AND FORK THIS REPO.

hp1004/SPPU-SE-COMP-AI-DS-SEM-2-DSA-ALL-LAB-ASSIGNMENTS

Folders and files, repository files navigation, sppu-se-comp-ai&ds-sem-2-dsa-all-lab-assignments.

Consider a telephone book database of N clients. Make use of a hash table implementation to quickly look up client‘s telephone number. Make use of two collision handling techniques and compare them using number of comparisons required to find aset of telephone numbers (Python)

Implement all the functions of a dictionary (ADT) using hashing and handle collisions using chaining with /without replacement. Data: Set of (key, value) pairs, Keys are mapped to values, Keys must be comparable, Keys must be unique Standard Operations: Insert(key, value), Find(key), Delete(key) (python)

A book consists of chapters, chapters consist of sections and sections consist of subsections. Construct a tree and print the nodes. Find the time and space requirements of your method.

  • Beginning with an empty binary search tree, Construct binary search tree by inserting the values in the order given. After constructing a binary tree -
  • Insert new node.
  • Find number of nodes in longest path from root.
  • Minimum data value found in the tree.
  • Change a tree so that the roles of the left and right pointers are swapped at every node.
  • Search a value.
  • Construct an expression tree from the given prefix expression eg. +-- a*bc/def and traverse it using postorder traversal(nonrecursive) and then delete the entire tree

There are flight paths between cities. If there is a flight between city A and city B then there is an edge between the cities. The cost of the edge can be the time that flight take to reach city Bfrom A, or the amount of fuel used for the journey. Represent this as a graph. The node can be represented by airport name or name of the city. Use adjacency list representation of the graph or use adjacency matrix representation of the graph. Check whether the graph is connected or not. Justify the storage representation used

You have a business with several offices; you want to lease phone lines to connect them up with each other; and the phone company charges different amounts of money to connectdifferent pairs of cities. You want a set of lines that connects all your offices with a minimum total cost. Solve the problem bysuggesting appropriate data structures.

Given sequence k = k1 <k2 < ... <kn of n sorted keys, with a search probability pi for each key ki . Build the Binary search tree that has the least search cost given the access probability for each key?

A Dictionary stores keywords & its meanings. Provide facility for adding new keywords, deleting keywords, updating valuesof any entry. Provide facility to display whole data sorted in ascending/ Descending order. Also find how many maximum comparisons may require for finding any keyword. Use Height balance tree and find the complexity for finding a keyword

  • Read the marks obtained by students of second year in an online examination of particular subject. Find out maximum and minimum marks obtained in that subject. Use heap data structure.Analyze the algorithm.

Department maintains a student information. The file contains roll number, name, division and address. Allow user to add, delete information of student. Display information of particular employee. If record of student does not exist an appropriate message is displayed. If it is, then the system displays the student details. Use sequential file to maintain the data.

Company maintains employee information as employee ID, name, designation and salary. Allow user to add, deleteinformation of employee. Display information of particular employee. If employee does not exist an appropriate message is displayed. If it is, then the system displays the employee details. Use index sequential file to maintain the data.

Connect With Me:

Contributors 2.

@hp1004

  • Python 8.8%

IMAGES

  1. Solved Data Structure Lab [JAVA] Final Term Lab

    data structure lab assignment

  2. Data structures lab manual

    data structure lab assignment

  3. 40 Lab Report Templates & Format Examples ᐅ TemplateLab

    data structure lab assignment

  4. Data structure new lab manual

    data structure lab assignment

  5. PPT

    data structure lab assignment

  6. 2 Advanced Data Structure Lab: Important Concepts

    data structure lab assignment

VIDEO

  1. Data Structure : Lab 1

  2. Data Structure : Lab 5

  3. Data Structure

  4. Data Structure Lab 9

  5. Data Structures and Algorithms Lab 3 Project

  6. Data Structure

COMMENTS

  1. PDF Data structures Lab Manual

    This book "data structures" lab manual is intended to teach the design and analysis of basic data structures and their implementation in an object-oriented language. Readers of this book need only be familiar with the basic syntax of Java and similar languages. The "data structures Concepts" is

  2. PDF Data Strucures Lab Manual

    Data Structures Lab (CSC 204) Dept. of CSE, IIT (ISM) Dhanbad Monsoon 2021-22 LABORATORY-4 (LINKED LIST-II) Objectives: To dive deep into linked list data structures, it types and different algorithms related to it. Brief Theory: Linked List is a linear data structure and it is very common data structure which consists of group of

  3. Data Structures and Files Assignments

    Store data of students with telephone no and name in the structure using hashing function for telephone number and implement chaining with and without replacement. Assignment10.cpp A business house has several offices in different countries; they want to lease phone lines to connect them with each other and the phone company charges different ...

  4. Coursera-Data_Structures_and_Algorithms

    This repository contains my solutions to the Data Structures and Algorithms assignments offered by the University of California, San Diego (UCSD) and the National Research University Higher School of Economics (HSE) on Coursera. All of the problems from courses 1 through 6 have been solved using Python. These solutions are intended to serve as a reference for those working on these assignments ...

  5. Learn Data Structures and Algorithms

    Learning data structures and algorithms allow us to write efficient and optimized computer programs. Our DSA tutorial will guide you to learn different types of data structures and algorithms and their implementations in Python, C, C++, and Java. Do you want to learn DSA the right way? Enroll in our Interactive DSA Course for FREE. What is an ...

  6. Data Structure and Algorithms lab assignments using C++

    DSA assignments. This is a collection of DSA lab assignments using C++ assigned during 4th semester Bachelor of Computer Engineering (BCT) for the completion of the course Data Structure and Algorithm [CT 552]. Year: II.

  7. Assignment 4: Stacking Queues

    The fourth assignment is mostly about stacks and queues. For the former you'll build a simple calculator application, for the latter you'll implement the data structure in a way that satisfies certain performance characteristics (in addition to the usual correctness properties). Problem 1: Calculating Stacks (50%)

  8. Data Structures, Debugging

    Lecture 4: Data Structures, Debugging (PDF) Lab Exercises. The primary goal of this lab period is to introduce debugging tools, and use of unions/structs. Exercise 1. Download and install Valgrind on your system, if it's not already. To test if you have Valgrind, run valgrind --version. It should print the version of Valgrind that is installed.

  9. PDF CS19001: Programming and Data Structures Laboratory

    Assignment 1: [Binomial-Sum] Recall the binomial theorem: (x + y)n = nC0xny0 + + nCixn iyi + + nCnx0yn. Write a C program which takes as input two reals ( oats) x and y, a non-negative integer n and returns the value of. (x + y)n as double. Your program should contain the following functions.

  10. Data Structures Lab (2-1-1)

    The laboratory assignments will be mainly implementation-oriented which have to coded in C and will be based the topics discussed in theoretical lectures. 7. Grading Policy : o Component 1 -Lab assignments and a lab test will form the 10% of this component. o Component 2 - Lab assignments and lab test will form the 10% of this component.

  11. PDF Laboratory Manual Data Structures and Algorithm Lab

    SUBJECT NAME: DATA STRUCTURES AND ALGORITHM LAB CODE : PC252CS SEMESTER : III CO No. Course Outcomes Taxonomy Level PC252CS.1 Understand and Implement the abstract data type and reusability of a particular data structure. APPLYING-3 PC252CS.2 Implement linear data structures such as stacks, queues using array and linked list. APPLYING-3

  12. Data Structures

    Data Structures. Assignments are due at 11:00PM. The due dates are strictly followed. Assignments are graded automatically by AutoLab. Your program must compile without errors on Autolab - otherwise you will not receive any credit for the assignment. For each problem, your code will be tested using a suite of test cases, and you will receive ...

  13. PDF UCS-406 (Data Structure) Lab Assignment-1 (2 weeks)

    UCS-406 (Data Structure) Lab Assignment-1 (2 weeks) Implement the following programs in C/C++/Python/Java using functions a) Insertion Sort b) Bubble Sort c) Selection Sort d) Linear Search e) Binary Search f) Shell sort Q 1. Display the total number of comparisons and swappings made by each searching/sorting function for the given input N.

  14. Data Structures Tutorial

    Data structures are essential components that help organize and store data efficiently in computer memory. They provide a way to manage and manipulate data effectively, enabling faster access, insertion, and deletion operations. Common data structures include arrays, linked lists, stacks, queues, trees, and graphs , each serving specific purposes based on the requirements of the problem.

  15. COL106/CSL201: Data Structures

    COL106/CSL201: Data Structures. The Re-major will be held on July 27 at 5pm in 501 Bharti. All evaluations can be found here (CSL201) and here (COL106). Please report any discrepancies immediately. Any submission of assignment 5 after the final deadline (6pm, May 8) has not been (and will not be) considered.

  16. Lab 6

    CptS 122 - Data Structures. Lab 6: Data Structures and Dynamic Binary Search Trees (BSTs) in C. Assigned: Week of October 1, 2012. Due: At the end of the lab session. I. Learner Objectives: At the conclusion of this programming assignment, participants should be able to: Design, implement and test a dynamic BST in C.

  17. Lab Assignment 1 M21

    Lab Assignment #1 - Using Fundamental Data Structures. Due Date: Friday midnight, Week 3. Purpose: The purpose of this Lab assignment is to: Design and develop Applications that incorporate fundamental data structures such as: Singly Linked Lists Doubly Linked Lists Circularly Linked Lists

  18. LAB1 DSA

    Lab Assignment school of information technology and engineering course title digital structures and algorithms course code: ite1004 name: utkarsh goyal reg no: ... Data Structures & Algorithms (CS 3800) 18 Documents. Students shared 18 documents in this course. University Indiana Institute of Technology. Academic year: 2022/2023.

  19. SPPU-2019-Pattern-SE-COMP-Fundamentals-of-Data-Structures ...

    GroupA_Practical2(python) : Experiment Number 2 : Write a python program to store marks stored in subject "Fundamentals of Data Structure" by N students in the class. Write functions to compute following: 1. The average score of the class. 2. Highest score and lowest score of the class. 3. Count of students who were absent for the test. 4.

  20. Data Structure Lab Assignment

    Data Structure Lab Assignment - Free download as PDF File (.pdf), Text File (.txt) or read online for free. This document contains code for several data structures and algorithms assignments: 1. An array-based implementation of an ordered list with functions for insertion, deletion, and reversal. 2. Polynomial and sparse matrix representations and operations using array of records and linked ...

  21. Data Structure Lab

    This contains the code of different problems given to us in the lab ucs406 data structures and algorithms lab assignment question arraylist and its functions. Skip to document. University; High School; Books; Discovery. ... UCS406 Data Structures and Algorithms Lab Assignment 2. Question 1: ArrayList and its functions. #include&lt;bits/stdc++.h ...

  22. CS 225

    Part 1: The PuzzleState data structure. In the first part of this assignment we will work on representing the puzzle as a graph. To do this we will have a node for every possible position of the puzzle and an edge between two nodes if there is a single move of a tile that will move from one position to the next.

  23. DATA Structure Lab Assignment

    DATA Structure Lab Assignment - Free download as Word Doc (.doc / .docx), PDF File (.pdf), Text File (.txt) or read online for free. Scribd is the world's largest social reading and publishing site.

  24. Sppu-se-comp-ai&Ds-sem-2-dsa-all-lab-assignments

    THIS REPO CONTAINS ALL THE DATA STRUCTURES LAB ASSIGNMENTS OF THE SPPU SECOND YEAR COMPUTER AND AI&amp;DS 2019 PATTERN SYLLABUS. USE THIS FOR REFERENCE. STAR AND FORK THIS REPO. - hp1004/SPPU-SE-...