Skip to content

A repository containing code for Labs of Data Structures & Algorithms (DSA) course at NUST

License

Notifications You must be signed in to change notification settings

ShahzaibAhmad05/DSA-Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSA-Lab

This repository contains the implementation and solutions for Labs of my Data Structures and Algorithms (DSA) course at NUST.

Contents

Lab2

  • hello.cpp:
    • Purpose: Prints a welcome message to the console.
    • Input/Output: Outputs "Welcome to DSA Lab 2!" to the terminal.
  • salary.cpp:
    • Purpose: Manages employee salary data with dynamic memory allocation.
    • Input/Output: Takes 20 employee salaries as input and outputs updated salaries after applying an increment formula.
  • string_reverse.cpp:
    • Purpose: Reverses a user-provided string using dynamic memory allocation.
    • Input/Output: Accepts a string from user input and displays the reversed version of that string.
  • analyze_pointer.cpp:
    • Purpose: Demonstrates pointer operations and memory analysis.
    • Input/Output: Creates pointers and displays their addresses and values they point to.

Lab3

  • LinkedList.cpp:
    • Purpose: Implements a singly linked list with various insertion, deletion, and traversal operations.
    • Input/Output: Takes user input for operations (insert/delete/display) and outputs the current state of the list or operation results.
  • queue.cpp:
    • Purpose: Implements a queue data structure using linked nodes with enqueue, dequeue, and peek operations.
    • Input/Output: Accepts values to enqueue and performs queue operations, displaying the queue contents and operation results.
  • CircularLinkedList.cpp:
    • Purpose: Implements a circular linked list with operations for insertion, deletion, and traversal in a circular structure.
    • Input/Output: Takes values for insertion/deletion operations and displays the circular list structure and operation outcomes.

Lab4

  • tower_of_hanoi.cpp:
    • Purpose: Implements a Game of Tower of Hanoi and a Algorithm that solves it.
    • Input/Output: Takes in how many disks the game should include and displays Information about how the Algorithm solves it including the number of total moves.
  • braces_checker.cpp:
    • Purpose: Tests if an mathematical expression makes correct use of closing and opening braces for all types of braces ( () , [] , {} ).
    • Input/Output: Takes a mathematical expression in form of a string as Input and displays whether the expression makes correct use of braces or where there was a mistake.
  • string_reversal_using_stack.cpp:
    • Purpose: Implements a reversal of a string using a stack.
    • Input/Output: Takes a string for reversal and displays the reversed string.

How to Run

  1. Clone this repository:
    git clone https://github.com/ShahzaibAhmad05/DSA-Lab2.git
    

Contributions are welcome!

You can:

  • Add helpful comments in code files.
  • Suggest more efficient algorithms.
  • Fix spelling/grammar in code or documentation.