Skip to content

surajsureshkumar/Masters-Assignments

Repository files navigation

Coursework homework/assignments for Computational Problem Sovling

skyscrapers.py

  • Validates a Skyscraper puzzle configuration based on standard puzzle rules.
  • Reads puzzle size, clues, and matrix layout from a structured text file.
  • Ensures matrix values are in the valid range and checks for duplicates in rows and columns.
  • Performs directional visibility checks (North, South, East, West) to verify that the number of visible skyscrapers from each clue matches expectations.
  • Prints helpful debug messages to highlight any invalid entries or visibility mismatches.

quilt_design.py

  • Draws a quilt composed of three blocks using Python's Turtle graphics.
  • Initializes the drawing canvas and constructs a uniform square border for each quilt block.
  • Block 1: Draws four large purple triangles and interleaved small red triangles in a circular layout.
  • Block 2: Creates colored triangle pairs in four directional quadrants using loops and position resets.
  • Block 3: Generates a colorful spiral design with a bounding square, showcasing creativity and independent design.
  • Uses structured positioning and color loops to create visually appealing geometric patterns.

food_truck.py

  • Demonstrates QuickSort and QuickSelect algorithms to solve a facility location problem.
  • Reads a list of building positions from an input file, assuming the last column in each line represents a coordinate.
  • Applies QuickSort to find the median position for minimal total distance calculation.
  • Uses QuickSelect for an optimized approach to find the median without fully sorting the list.
  • Compares the execution time and total distance of both approaches to highlight performance differences.
  • Useful in real-world scenarios like choosing optimal food truck or warehouse locations based on customer spread.

Please do not copy the code files for your assignment, rather run it locally and understand how it works. Copying content for your assignment or homework is strictly prohibited, as it may result in plagiarism.

About

Implementation of various algorithms in python

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages