# A Jamming-Resilient and Scalable Broadcasting Algorithm for Multiple Access Channel Networks
## 4 Proposed Broadcast Algorithm
```
Initialization \(k\) = 4 /* the segment size = 4, 8, 16, 32, 64 */ range_stack = {(1,k)} // stack of ranges to check range \(\leftarrow\) \(\emptyset\) // current range /* segment process start */ node_id = activation_round // getting node id based on activation round repeat repeat \(range\leftarrow\) Pop(_range_stack_) ifnode_id  in range  and IsQueueNotEmpty(_node_id_) then  Broadcast() // transmitting a packet from the queue on the channel if feedback = silence then ifrange_stack is empty then  Terminate() // ending the segment processing else if feedback = packet then /* the node keeps broadcasting until the queue is empty */ repeat  Broadcast() until feedback = silence Clear(_range_stack_) Push(_range_stack_,(1,k)) else /* collision case ifSize(_range_stack_) = 2 then /* the two nodes transmits all their packets consecutively */ repeat /* the first node transmitting */ Broadcast() until queue is empty for the first node Wait_Silence() repeat /* the second node transmitting */ Broadcast() until queue is empty for the second node Wait_Silence() Clear(_range_stack_) Push(_range_stack_,Range((1, k))) else /* divide the range and store in the stack */ Push(Range(_range_stack_,first_half)) Push(Range(_range_stack_,second_half)) until segment terminates
```  
**Algorithm 1**K-tuple full withholding. During the segment processing phase, a binary search tree is performed to find a range of nodes with a single active node. The searching process begins from the initial range, in which all nodes with IDs in the range \([1,k]\) are given access to the channel. In turn, these nodes will attempt to transmit their packets in the current round. When the feedback is a collision, the search process divides the range into two halves, which are processed consecutively. Otherwise, when a node successfully transmits its packet, the node retains sole access to the channel, which is known as _withholding_. The node continuously transmits all packets from its queue for the next several rounds until the queue is empty. When silence is detected on the channel after the successful transmission of all packets in the queue, the segment processing phase is reset so that the new search starts from the root node, in which all nodes in the range \([1,k]\) participate in the execution. The algorithm employs a special processing case when the searching process reaches a range of size 2. When there is collision feedback, the algorithm provides the two nodes with consecutive access to the channel, which is first provided to the node with the lower ID to transmit all packets from its queue. The next node begins transmitting its packets when silence is detected. Finally, the segment processing is reset when the second node finishes transmitting all packets, and the second silence is detected. The segment terminates when silence is identified at the root node, which implies that all packets from all activated nodes have been transmitted successfully. Afterward, the algorithm continues processing the next segment, which consists of a new set of activated nodes. All nodes run the broadcast algorithm as long as they remain connected to the network, even when they are passive. Each node only participates in the segments in which it was activated, while the node stays silent during other segments. Next, we describe the synchronization step which is performed by any new node joining the network. This step is required to maintain the synchronized execution of the KTFW algorithm between all nodes. Because all nodes have locally synchronous clocks, synchronization is performed through a local round number reset by identifying unique cases. In the synchronization step, two cases are considered, in which network activity is either present or not. In the case of network activity, a new node must identify the start of a segment before beginning the execution of the KTFW algorithm. In this step, the node keeps listening to feedback from the channel until a unique pattern is identified.