Skip to content

Instantly share code, notes, and snippets.

@halitbatur
Created May 15, 2024 09:54
Show Gist options
  • Save halitbatur/44a4222a3a72f8134b55c9d28aeacf49 to your computer and use it in GitHub Desktop.
Save halitbatur/44a4222a3a72f8134b55c9d28aeacf49 to your computer and use it in GitHub Desktop.
DSA Discussion

Discussion questions about DSA and Algorithims in Javascript

  1. Discuss the concept of recursion in programming. How does it work, and in what scenarios might recursion be more advantageous than iterative solutions?
  2. Explain the difference between time complexity and space complexity in algorithms. Why is it important to consider both when evaluating the efficiency of an algorithm?
  3. What distinguishes linear data structures from non-linear data structures? Provide examples and use cases where one might be preferred over the other.
  4. Discuss difference between linear and binary search
  5. In your own words explain the following data structures:
  • Linked List
  • Stack
  • Queues
@samuelthis
Copy link

  1. Recursion is when the function is calling itself, it is also used to solve problems that contain smaller sub-problems. Moreover, Recursion is a programming technique where a function calls itself repeatedly until it reaches a base case that stops the recursion. In other words, a function solves a problem by breaking it down into smaller sub-problems of the same type, and then solving those sub-problems using the same function.
  2. Time complexity, is used to measure the amount of time required to execute the code. Space complexity, means the amount of space required to execute successfully the functionalities of the code. Both of the above complexities are measured with respect to the input parameters.
    3.Linear Data structure where data elements are arranged sequentially or linearly where each and every element is attached to its previous and next adjacent for example [list, array, stack and queue]. while Non-linear data structure, where data elements are not arranged sequentially or lineary example [map, graph and tree].
  3. In linear search input data need not to be in sorted. In binary search input data need to be in sorted order.
    • Linked List, is a collection of nodes, each containing a value and a reference to the next node. Each node is connected to its neighbors through pointers or references. Linked lists allow for efficient insertion and deletion of elements at any position.
  • Stack, A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle.
  • Queues, foundational concept in computer science used for storing and managing data in a specific order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment