dsa-assignment-2

Problem I



When

Problem II

  1. initial state:
    • |1|3|6|5|4|7|
  2. insert(1)
    • |1|3|6|5|4|7|
  3. insert(3)
    • |3|1|6|5|4|7|
  4. insert(6)
    • |6|1|3|5|4|7|
  5. insert(5)
    • |6|5|3|1|4|7|
  6. insert(4)
    • |6|5|3|1|4|7|
  7. insert(7)
    • |7|5|6|1|4|3|
  8. deleteMax()
    • |6|5|3|1|4|7|
  9. deleteMax()
    • |5|4|3|1|6|7|
  10. deleteMax()
    • |4|1|3|5|6|7|
  11. deleteMax()
    • |3|1|4|5|6|7|
  12. deleteMax()
    • |1|3|4|5|6|7|

Problem III

Problem IV

initial state:

                              25|3                              
                ┌───────────────┴───────────────┐               
              13|1                            80|2              
        ┌───────┴───────┐               ┌───────┴───────┐       
       6|0            15|0            58|1            82|0      
                                        └───┐                   
                                          65|0       

insert:29

                              25|3                              
                ┌───────────────┴───────────────┐               
              13|1                            80|2              
        ┌───────┴───────┐               ┌───────┴───────┐       
       6|0            15|0            58|1            82|0      
                                    ┌───┴───┐                   
                                  29|0    65|0          

insert:70

                              25|3                              
                ┌───────────────┴───────────────┐               
              13|1                            65|2              
        ┌───────┴───────┐               ┌───────┴───────┐       
       6|0            15|0            58|1            80|1      
                                    ┌───┘           ┌───┴───┐   
                                  29|0            70|0    82|0  

insert:68

                              65|3                              
                ┌───────────────┴───────────────┐               
              25|2                            80|2              
        ┌───────┴───────┐               ┌───────┴───────┐       
      13|1            58|1            70|1            82|0      
    ┌───┴───┐       ┌───┘           ┌───┘                       
   6|0    15|0    29|0            68|0    

Problem V

a)





b)

  1. “insert.png” could not be found.
  2. “delete.png” could not be found.