Skip to content

Leo5050xvjf/2022_NTU_CSIE-DSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

2022-NTU-CSIE-DSA

HW0: Big Integer Problem

Reference

Description

Develop a calculator that can compute numbers beyond the limitations of built-in data types.

HW1: Simple Integer Calculations

Description

Implement a program to calculate expressions. It should include:

  • Arithmetic operators: +, -, *, /, % (Note: '/' denotes integer division, i.e., a/b = $\lfloor\frac{a}{b}\rfloor$)
  • Parentheses: (, )
  • Example: For an input like 1+2=*5+(1+7+11)=%5-11=, the program should output the correct result.

HW2: Purple Cow

Description

Utilize Doubly Linked List and XOR linked list to address the given problem.

Solution

Implement data structures to support reverse operation of the linked list in O(1) time complexity. Additionally, ensure that traversal order adheres to the problem requirements.

  • Initial approach: Use a special pointer (super_link) to meet the problem's demands, ensuring efficient and elegant code.

HW3: Magic Certification

Description

Give a string and add the minimum number of characters to convert it into a palindrome.

Solution

  1. Find the longest palindrome on the left and right sides. Example: Input: "aabc", Left: "aa" -> 2, Right: "c" -> 1
    • Use a method similar to the KMP string matching algorithm. Build a KMP table bidirectionally.
    • Determine the longest palindrome side, then reflect the string on that side without duplicating the palindrome.

HW4: Purple Cow Revenge and COOL Server

Description

  1. Disjoint Set
  2. Offline algorithm
  3. Array operations and challenges (Detailed in HW4.pdf).

Solution

  1. Record data offline to backtrack to a specific day.
  2. Implement a segment tree and treap (min heap + binary tree).
  3. Apply a lazy tag for efficient updates.(吉如一線段樹)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published