Month: December 2022

Median Search Tree

If the sorted array of all the values in the set is {ai} n

i=1, let t = n/2, then the median 2k values are

{atk+1, · · · , at+k}.

Barbara has got a set of values with size of 2k initially. Barbara wants to do m operations on it. Each

operation belongs to the following 3 types:

  • 1 w: insert a value w.
  • 2: output all the median 2k values, i.e. atk+p, 1 p 2k.
  • 3 p: delete the p-th value among median 2k values, i.e. atk+p.

We guarantee that all the values will be distinct and the size of the set is always at least 2k.

Special Shortest Path

City C consists of n nodes, representing different places. There are m edges between these nodes. For

the edge ei = (ui , vi , wi), there is a bidirectional(undirected) trail connecting ui and vi with length of

wi .

For a path P = {pi}, consisting of edges p1, p2, p3, · · · , pk, the length of each edge is li = wpi . Normally,

passing the edge pi with length li will cost li units of energy. Specially, if li = K · li1, then passing

this edge will only cost (K 1) · li1 units of energy.

Alice is starting from the node 1. Alice wants to know how many units of energy it will take at least

to visit the node x, for any x. If x is unreachable from the start point(node 1), you should output 1

as the result.

Chess Game

The program should respect the rules of chess, for example,

  • the movement of pieces (including castling and en-passant),
  • piece promotion, check
  • checkmate
  • stalemate

Please review the rules of chess to verify your understanding of the game!

  • You can implement your system on any platform and language you want as long as

it is available in our labs (can be run in our labs). You may have to show me/TA

how it works in some cases.

  • The program must use a game tree search scheme with alpha-beta pruning.

Furthermore, the program should permit user-supplied control parameters, for

example, the depth of search.

  • Put effort towards designing an effective board evaluation function. You should

research the literature on computer chess to find strategies used by other systems.

You can borrow ideas from the literature (properly acknowledged in your report).

I also encourage you to try your own ideas!

  • The program should interact with a human player. Both human vs human and

human vs ai options should be available. Moves should be given via board

coordinates. At the minimum, the program should dump out the current board as an

ASCII table (e.g., upper case = black, lower case = white, space = “-“,). Although

a graphical user interface is not required, an effective GUI will be positively

considered during evaluation.

  • Your program should permit any board setup to be used initially (This is good for

testing purposes).

  • An option is that your program should dump out the game in terms of a standard

chess output text file.