Matching Brackets


Work with your assigned partner to find a solution to the following problems. Write out the pseudocode and determine which data structure is needed.

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if open brackets are closed by the same type of bracket in the correct order.

isValid("({([()])})") //returns true
isValid("({[(])})") //returns false



Messages

Consider the following class:

public class Receiver
{
   ...
   
   /**
    * Logs when a message is received
    * @arg timestamp - the time in ms 
    */
   public void receive_message(int timestamp)
   {
      ...
   }

   /**
    * @arg start - the start time in ms
    * @arg end - the end time in ms
    * @return the number of messages within the window defined by the start and end
   public int num_messages_in_window(int start, int end)
   {
      ...
   }
}

Write the pseudocode to implement each method along with the necessary class attributes and data structures.


This page was last modified on 2026-11-04 at 04:14:03.

Copyright © 2018–2026 George Fox University. All rights reserved.