{"id":19291409,"url":"https://github.com/hassan11196/ds-assignments","last_synced_at":"2026-04-18T10:33:18.724Z","repository":{"id":106052407,"uuid":"244665665","full_name":"hassan11196/DS-Assignments","owner":"hassan11196","description":"Data Structures Assignments - FAST NUCES (Karachi) - CS201 - Fall 2018","archived":false,"fork":false,"pushed_at":"2020-03-03T15:58:26.000Z","size":10341,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-30T02:43:19.767Z","etag":null,"topics":["bfs","c","cpp","data-structures","dfs","infix","optimization","pathfinding","postfix"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hassan11196.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-03T15:00:58.000Z","updated_at":"2020-11-14T19:08:06.000Z","dependencies_parsed_at":"2024-05-27T23:28:16.639Z","dependency_job_id":null,"html_url":"https://github.com/hassan11196/DS-Assignments","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hassan11196/DS-Assignments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassan11196%2FDS-Assignments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassan11196%2FDS-Assignments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassan11196%2FDS-Assignments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassan11196%2FDS-Assignments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hassan11196","download_url":"https://codeload.github.com/hassan11196/DS-Assignments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassan11196%2FDS-Assignments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31965902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bfs","c","cpp","data-structures","dfs","infix","optimization","pathfinding","postfix"],"created_at":"2024-11-09T22:25:13.513Z","updated_at":"2026-04-18T10:33:18.707Z","avatar_url":"https://github.com/hassan11196.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Structures Assignments\n\n## Assignment 1\n### Problem 1- Way-Out from a Maze\nThis problem uses DynamicSafe2DArray as discussed during the lecture. A maze is an object of\nDynamicSafe2DArray of char type. The content of the array can be any character {- (path), *\n(block), s (start), e (end), ! (visited)}.\nThe input maze may contain only one-path and you need to implement a recursive path finding\napproach that enumerate all cell of the array that are on the path in order of traverse from start s to\nend e. Here is an example of a maze.\n\n    * s * * * * * * * *\n    * - - * * * * * * *\n    * * - - * * * * * *\n    * * * - * * * * * *\n    * * * - - - - * * *\n    * * * * * * - * - e\n    * * * * * * - * - *\n    * * * * * * - * - *\n    * * * * * * - - - *\n    * * * * * * * * * *\n\nAll you need to develop a recursive routine for finding path, the search is only allowed to follow\n{Left, Right, Up and Down} from any location. The output for this problem is complete path from\nstarting to end location. The validation of input cases required as start and end location must be at\nthe boundary of the maze. There may be one or no path for all valid input cases.\n\n\n### Problem 2 – Brute Force Sequence matching\nIn bioinformatics, a sequence alignment is a way of arranging the sequences of DNA, RNA, or\nprotein to identify regions of similarity that may be a consequence of functional, structural, or\nevolutionary relationships between the sequences. In this problem there are two sequences of\nvariable length given to you, you can keep them in simple DynamicSafeArray. The brute force\nsequence matching algorithm finds the maximum sequence of match from the two given sequence.\nObviously this maximum match would not be larger than the smaller sequence. The sequence\nmatching may disallow characters in either sequence that already appears in the earlier match, but\nmissing from the next possible match. For example, consider the sequence S1 and S2\n\n    S1: ACTTGTTACTGTTACCT\n\n    S2: ACTGTACTGTACT\n\n    Matched: ACT*GT*ACTGT*AC*T\n\nHere the matched sequence is greater than the length of the smallest sequence as we are\ndisallowing match of a character that earlier matched. In the above example there are four such\ninstances hence the match sequence is of length |s2| + 4.\n\n### Problem 3 – KQUERY\n\nYou are given an array of numbers, there can be n numbers where n is between (1 \u003c= n \u003c= 30000).\nEach number is between (1 \u003c= ai \u003c= 109). You are also given “t” queries of the form qt ( i, j, k)\nwhere ( 1 \u003c= i \u003c= j \u003c=n) for each query you need to return the number of elements greater than k\nin the sub-sequence ai, ai+1, ....., aj you need to process all t queries in the same fashion.\n\n\n## Assignment 2\n### Problem 1- Optimal Way-Out from a Maze\n\nYou are now well aware of how to get a solution rom a maze. The content of the array can be\nany character {1 (path), 0 (block), s (start), e (end), ! (visited)}.\nThe input maze may contain multiple-paths and you need to implement a recursive path finding\napproach that enumerate all cell of the array that are on the unique path in order of traverse from\nstart s to end e. You need to enumerate all paths. Here is an example of a maze.\n\n    s 1 1 1 1 1 0\n    1 0 0 1 1 0 1\n    1 0 0 0 1 0 1\n    1 1 1 e 1 1 1\n\nThere are three possible paths:\n\nPath#1= {(0,0),(0,1),(0,2),(0,3),(1,3),(2,3),(3,3)} Cost=7\n\nPath#2= {(0,0),(1,0),(2,0),(3,0),(3,1),(4,1),(4,2),(4,3),(3,3)} Cost=9\n\nPath#3= {(0,0),(1,0),(2,0),(3,0),(4,0),(4,1),(4,2),(4,3),(3,3)} Cost=9\n\nAll you need to develop a recursive routine for finding path, the search is only allowed to follow\n{Left, Right, Up and Down} from any location. The output for this problem is complete path from\nstarting to end location. The validation of input cases required as start and end location must be at\nthe boundary of the maze. There can be several paths for all valid input cases. You need to\nenumerate all paths from starting to each cell followed till the end. The cost of a path is total\nnumber of cell traveled. Hence the shortest path or optimal path is the minimum length path.\n\n### Problem 2- Infix to Postfix conversion and evaluation\n\nArithmetic expressions are made of operators (+, -, /, *, ^, etc.) and operands (either numbers,\nvariables or, recursively, smaller arithmetic expressions). The expressions can be written in a\nvariety of notations. In this problem, you will focus on two standard arithmetic expression\nnotations: infix and postfix. In Infix expression, operators are written in-between their operands.\nThis is the usual way we write expressions, for example x+y. Similarly, Postfix notation (also\nknown as \"Reverse Polish notation\"): x y + Operators are written after their operands. There is a\ngeneral algorithm that convert an infix expression to postfix using stack (data structure).\n\n### Problem 3- Simulation of Queuing Systems\n\nThe Shop-n-Carry (SC) is a big chain of departmental stores. The SC would like to improve its\ncustomer services. There has been a complained for some period that the waiting time to avail\nPoint-of-Sale terminal services is unbearable for some areas in stores. SC is planning to improve\nthe services by means of installing more POS terminals to those stores, which are in heavy use,\nand customers have to wait for making payments. You have been hired, as a consultant by the SC\npresident to determine whether this idea is feasible or not. The management has decided that if the\naverage waiting time of a user at a POS is greater than 3 minutes to get their services. They will\ninstall one more POS terminal machine. It is provided that the arrival rate of POS customer is\nanytime within the opening hours and the average service time is between 3 to 8 minutes. The POS\nis operational 18 X 7. Your job is to run a simulation program for SC POS for 18 hours, and\ncalculate the average waiting time for customers on hourly basis. Identify the busy hours. Use the\nleast count of the clock as discrete unit of minutes. Put the entire statistic in the output file which\nis as follows:\n- Number of customers\n- Average waiting time (for each hour – in a separate line)\n- Average Customers (for each hour – in a separate line)\n- POS utilization time (Average Service Time)\n\n## Assignment 3\n\n### Problem 1- Determining compatible set of intervals for media channel.\n\nOne of the main application of Binary Search Trees are for handling a dynamically changing\ndatasets. This can be very efficient choice for deciding many compatible issues. One of the media\nchannel is looking to decide a non-overlapping intervals for their transmission. Each program from\nthe channel is comprises of a start time, duration and commercial time for the program. For an\nexample an Interval I (start_time, duration, ctime) = (2, 6, 3) implies that the program starts at 2\nand can be finish by 11 with commercial time included for on airing the show. The program\nmanagers collect all programs information is a single file. There are 5 program managers and each\nprovides program information in a file. All you need to maintain a combine data structures that\nmaintain a non-overlapping compatible set of programs for the channel and maintain a separate\nfile for all those program that are conflicting in time. \n\nFor example, consider the files from the 2 programs managers:\n\nProgram Manager #1 \n\n    5\n    2 3 2\n    54 5 2\n    9 10 1\n    26 10 4\n    65 5 4\n\nProgram Manager #2\n\n    3\n    16 4 4\n    7 5 3\n    3 3 1\n\nThe channel does not want a silent period of transmission and select a program that is close to reduce the silent time.\n\nCompatible Programs \n\n    2 3 2\n    7 5 3\n    16 4 4\n    26 10 4\n    54 5 2\n    65 5 4\n\nConflicting programs\n\n    3 3 1\n    9 10 1\n\nYou need to maintain a BST for maintaining a set of compatible programs. The searching and\nfinding a conflict in program can be perform in log n time.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhassan11196%2Fds-assignments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhassan11196%2Fds-assignments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhassan11196%2Fds-assignments/lists"}