Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 2.49 KB

Day 18 - Algorithms Assignment.md

File metadata and controls

39 lines (31 loc) · 2.49 KB

Day 18: Algorithms

Tasks/Activities:

Activity 1: Sorting Algorithms

  • Task 1: Implement the bubble sort algorithm to sort an array of numbers in ascending order. Log the sorted array.
  • Task 2: Implement the selection sort algorithm to sort an array of numbers in ascending order. Log the sorted array.
  • Task 3: Implement the quicksort algorithm to sort an array of numbers in ascending order. Log the sorted array.

Activity 2: Searching Algorithms

  • Task 4: Implement the linear search algorithm to find a target value in an array. Log the index of the target value.
  • Task 5: Implement the binary search algorithm to find a target value in a sorted array. Log the index of the target value.

Activity 3: String Algorithms

  • Task 6: Write a function to count the occurrences of each character in a string. Log the character counts.
  • Task 7: Write a function to find the longest substring without repeating characters in a string. Log the length of the substring.

Activity 4: Array Algorithms

  • Task 8: Write a function to rotate an array by k positions. Log the rotated array.
  • Task 9: Write a function to merge two sorted arrays into one sorted array. Log the merged array.

Activity 5: Dynamic Programming (Optional)

  • Task 10: Write a function to solve the Fibonacci sequence using dynamic programming. Log the Fibonacci numbers.
  • Task 11: Write a function to solve the knapsack problem using dynamic programming. Log the maximum value that can be obtained.

Feature Request:

  1. Sorting Algorithm Script: Write a script that implements bubble sort, selection sort, and quicksort algorithms to sort arrays.
  2. Searching Algorithm Script: Create a script that implements linear search and binary search algorithms to find values in arrays.
  3. String Algorithm Script: Write a script that counts character occurrences and finds the longest substring without repeating characters.
  4. Array Algorithm Script: Create a script that rotates arrays and merges sorted arrays.
  5. Dynamic Programming Script: Write a script that solves the Fibonacci sequence and knapsack problem using dynamic programming.

Achievement:

By the end of these activities, students will:

  • Implement and understand common sorting algorithms.
  • Implement and understand common searching algorithms.
  • Solve string and number-related problems using algorithms.
  • Perform array operations using algorithms.
  • Apply dynamic programming to solve complex problems (optional).