Data Structure & Algorithm

 Data Structures 

Data Structure Tree & Graph

DSA Programs using C++


important questions and answers (learn complete syllabus below questions are just to tell you learn them in detailed )

Learn Algorithms for all techniques

  1. ·         Binary Search
  2. ·         Bubble Sort
  3. ·         Insertion sort
  4. ·         Selection Sort
  5. ·         Operations on Linked Lists – create, insert, delete, search,
  6. ·         evaluation of Postfix expressions
  7. ·         Graph Traversal (BFS and DFS)
  8. ·         Finding Shortest Path - Warshall's Algorithm

 

1.      time-space tradeoff:- (Ans :-A time-space tradeoff means that in programming, you can often make a program run faster by using more memory, or save memory by making it slower.

Example:
If you store answers in a list or dictionary, the program finds them quickly (less time) but uses extra memory (more space).  If you don’t store them, the program recalculates every time, which saves memory but takes more time.)

Big-O notation:-Big-O notation is used to measure the efficiency of an algorithm. It tells us how the running time or memory usage increases when the amount of input data increases.

Common types:

  • O(1) – Constant Time: Execution time stays the same no matter how much data there is.
    Example: accessing an element by index in an array.

  • O(n) – Linear Time: Time grows directly with the input size.
    Example: searching for a number in a list one by one.

  • O(n²) – Quadratic Time: Time grows very fast because of nested loops.
    Example: comparing every student with every other student in a class.

Big-O helps programmers choose better algorithms by comparing which one is faster or uses less memory for large inputs.

2.      String operations:- A string is a sequence of characters used to store text in programming.

It can contain letters, numbers, symbols, and spaces, and is usually written inside quotation marks.

Examples:

  • "Hello"

  • "12345"

  • "Good Morning"

In most programming languages:

  • A single character is called a character.

  • Multiple characters together form a string.

Strings are used for storing names, messages, passwords, addresses, and other text data.String operations are actions performed on strings (text data) in programming.

Common string operations:

  • Concatenation: Joining two strings together.
    Example: "Hello" + " World" → "Hello World"

  • Length: Finding the number of characters in a string.
    Example: length of "Apple" is 5.

  • Substring: Taking part of a string.
    Example: from "Computer", substring (0,3) → "Com"

  • Comparison: Checking if two strings are equal.
    Example: "cat" == "cat" → true

  • Searching: Finding a character or word inside a string.
    Example: finding "pen" in "open".

String operations are widely used in tasks like text processing, searching, passwords, and user input handling.



  • 3.      Double link list
  • 4.      evaluation of Postfix expressions and infix to Postfix Evaluation, Recursion
  • 5.      Circular queues, Priority queues,
  • 6.      Binary Search Tree (create, delete, search, insert
  • 7.      Linked and static Representation of binary trees
  • 8.      graph representation using Adjacency matrix and adjacency lists


No comments:

Post a Comment

Test Information

 Test Dates  All students are informed to attend mid term test as per below schedule assure your presence attendance is mandatory. Test Sc...