הפונקציות של היום 07.09.2025

public static void printList(Node<Integer> lst) {                 while (lst != null) {                                 System.out.print(lst.getValue()+ " --> ");                                 lst = lst.getNext();                 }                 System.out.println("null"); }                 public static Node<Integer>…

המחלקה SnakeGrid

למי שמעוניין לעשות שינויים במחלקה SnakeGrid מצורף קוד המקור import javax.swing.JFrame;import javax.swing.JLabel; import java.awt.BorderLayout;import java.awt.Color;import java.awt.ComponentOrientation;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Graphics;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.GridLayout;import java.awt.Rectangle;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import java.util.function.IntConsumer; import javax.swing.BoxLayout;import javax.swing.JButton;import javax.swing.JOptionPane;import javax.swing.JPanel;import…

הכנסה לעץ ממוין + סריקות (תוכית, תחילית וסופית)

הכנסה לעץ ממויןpublic static void insertIntoSortedTree(BinNode<Integer> root,int num) {                  if (num < root.getValue()) {            if (!root.hasLeft()) {                  BinNode<Integer> child = new BinNode<Integer> (num);                  root.setLeft(child);            }            else {                  insertIntoSortedTree(root.getLeft(),num);            }     …