## 4 Proposed Clustering Algorithm
### CH Selection Approach (Quantum)
The success probability can be illustrated after \(t\) Grover iterations, as follows [44]:  
\[t=CI\left(\frac{\frac{\pi}{2}-\varphi}{\omega}\right)=CI\left(\frac{\text{arc }\;\cos\;\langle q|\Phi\rangle}{2\text{arc}\;\sin\;\langle q|\Phi\rangle}\right) \tag{28}\]  
where \(CI\) means integer closest to the real number. In terms of security perspective, the quantum algorithm is more reliable than the classical algorithm is [45; 46]. Quantum algorithms are superior to their classical analogues when the input exists in a superposition state. In our case, all of the node information is encrypted in the superposition state which ensures high degree of security [47]. An Illustrative Example of the Quantum Approach  
In our proposed quantum weighted algorithm, as mentioned before, the limitations on the number of qubits are the main obstacles in quantum computing systems. Therefore, we only used an n = 4 qubit system to simulate the performance of our proposed quantum algorithm. Before approaching the quantum part, it is worth mentioning that in some previous research of clustering algorithms, such as EECS, all of the nodes need to send a message to the BS, and the CH needs to send at least three messages, which heavily increases the overhead complexity. Under HEED, a CH probably generates at least N iterations, which is a similar range of time complexity: O(N). Our main approach to implementing a quantum algorithm for CH selection is to reduce the time and overhead complexity. In a quantum computing system, CH selection can be achieved from one to two iterations using [PERSON]'s weighted search algorithm, which reduces overhead complexity to O (\(\sqrt{N}\)). The above-mentioned nodes, N = 16 = 24, can be formed into a superposition state with four qubits. Therefore, the initial state can be written from Equation (16):  
\[|\varnothing\rangle=\frac{1}{\sqrt{16}}(|0000\rangle+|0001\rangle+|0010\rangle \ldots\ldots\ldots\ldots+|1111\rangle)\]  
where \(|0000\rangle\), \(|0001\rangle\), \(|0010\rangle\), \(\ldots|1111\rangle\) represent node 1, node 2, node 3, \(\ldots\) node 16, respectively. Our probable CHs are node 10 and node 13 which is the marked state. [PERSON]'s algorithm will search for this marked state within one iteration, which can be proven by the mathematical formulation and IBM's QISKIT quantum simulation. In the classical CWCA algorithm, the nodes with the lowest weights, node 10 and node 13, will be eligible for CH selection. However, in a quantum algorithm, the highest weighted node will be selected as the CH. Therefore, to select the CH in the quantum approach, all of the nodes' corresponding weights need to be inverted, which is called inversion about the mean. In this process, the nodes' average weights will be calculated, and then, each node's corresponding weight is subtracted from two times the average value. By this process, we obtain new values for the nodes. From Table 3, we can see that the lowest weight nodes become the highest weighted ones. The target that needs to be found must be the node that has the highest weight under [PERSON]'s search algorithm. Using the traditional search algorithm, the complexity is linear, but [PERSON]'s search algorithm will predict comparatively better complexity. In terms of function, the above expression becomes: