Computer Science
Computer Science Solver
Trace code, analyse complexity, convert bases, write the algorithm.
5 solves a day signed in, 3 as a visitor.
The Computer Science Solver handles the range of questions in a CS curriculum. Trace a program and report the output with the variable state at each line. Find and explain a bug. Write a function or a short program to a specification, in the language you name. Analyse time and space complexity with the recurrence or the loop count shown. Walk a data structure operation: insert into a BST, heapify, hash with collisions, traverse a graph with BFS or DFS, run Dijkstra. Convert between binary, octal, decimal, and hexadecimal, including two's complement and floating point. Simplify Boolean expressions and build truth tables. Write and explain SQL queries. Regular expressions, finite automata, and basic proofs about algorithms, such as loop invariants and correctness of a greedy choice, are covered along with recursion tracing with the call stack drawn out.
Paste the code or the question. Screenshots of code and of exam questions work. Name the language for code you want written. For a trace, say what input to use. For complexity, say whether you want best, average, or worst case. For conversions, state the bit width when it matters. Include any constraints the assignment sets, such as "no built-in sort" or "recursive only". For a debugging question, paste the code and describe the wrong behaviour or the error message; the solver locates the fault, explains it, and gives the corrected lines. For a data-structure question, give the initial contents and the sequence of operations. For SQL, describe the tables and the columns.
Output: the answer first, which may be a program, a value, a Big-O bound, or a table. Then the reasoning: a trace table for execution questions, a loop-by-loop count for complexity, a step list for data structure operations, a place-value table for conversions. Code comes with comments on the non-obvious lines. The working is shown so you can check it by running the code yourself. For the discrete math underneath, modular arithmetic, counting, and proofs, use the Number Theory Solver. For matrix operations in an algorithm, use the Matrix Calculator. A follow-up can ask for the same function in another language, a test case that exposes the bug, or the trace continued with a different input. Recursive functions get the call tree drawn as indented lines so the order of evaluation is visible.
How to use it
- 1Paste the code or the question with constraints
- 2Name the language, the input, or the case
- 3Run the trace or the code to confirm
FAQ