def insert_after(head, k, val):
cur = head
i = 0
while cur and i < k:
cur = cur.next; i += 1
if not cur: return head # position out of bounds
node = Node(val)
node.next = cur.next
cur.next = node
return head
def remove_value(head, x):
dummy = Node(0); dummy.next = head
prev, cur = dummy, head
while cur:
if cur.val == x:
prev.next = cur.next
break # remove first occurrence; omit break to remove all
prev, cur = cur, cur.next
return dummy.next
def sum(A, n):
if n == 0:
return 0
return sum(A, n-1) + A[n-1]
Let’s address the elephant in the LAN party. How do you map "crouch-jump, lean, reload, weapon switch, zoom, and buy menu" onto a DualShock 2?
The answer was... awkward. The default control scheme for "cs 1.6 ps2" is legendary for its steep learning curve:
But here is the secret genius: USB Mouse and Keyboard support. Yes, on the PS2, you could plug in a standard USB mouse and keyboard. Plug them in, and the "cs 1.6 ps2" port instantly transforms. The game recognizes the mouse, disables aim-assist, and gives you a 80% faithful PC experience. It was one of the only console shooters of that generation to do this. cs 1.6 ps2
Counter-Strike is a game of microscopic adjustments: peeking a corner by 2 inches, aiming for the third pixel on a player’s head, and stopping instantly to fire. The DualShock 2 analog sticks were never designed for this.
The developers attempted a heroic fix: auto-aim. It isn't the subtle sticky crosshair of Halo; it is a violent, magnetic tug that pulls your reticle toward an enemy’s chest. While this makes the game playable, it destroys the skill gap. The poetry of a perfect one-tap headshot is replaced by the pragmatism of spraying center-mass and letting the computer do the math. def insert_after(head, k, val): cur = head i
There are two control schemes:
Neither feels good. You constantly feel like a pro driver forced to steer with a rubber band. def remove_value(head, x): dummy = Node(0); dummy
This report covers solutions, explanations, and key results for Problem Set 2 of a typical Computer Science 1.6 course (assumed topics: basic algorithms, data structures, recursion, complexity). I assume PS2 contains 4 problems: (1) recursion/recursive sums, (2) linked lists/arrays, (3) sorting/searching, (4) time complexity proofs. If your PS2 differs, tell me and I’ll adapt.