## 2 Related Works  
Many researchers worked to minimise the energy consumption used in routing. Therefore, different types of protocols have been developed. These protocols can be classified into four main parts: hierarchical, data-centric, location, and network flow protocols [11; 12]. In this paper, we will focus on hierarchical protocols. The general idea of routing is to process a specific path in the network from the start point to the endpoint to which the data can be transmitted. Therefore, this paper will focus on four protocols to route the data from node to base station in a Wireless Sensor Network. Some researchers have focused on a methodology that depends on transmitting sensed information between the base station and nodes [13]. Another approach was introduced to save energy, which will be wasted in the cluster head selection in each round, depending on which CH will remain unchanged when it has enough energy [14]. The Ad-LEACH protocol proposed by [PERSON] et al. [15] reduces power dissipation and the complexity of the network based on static clustering. The general idea is to separate the network into small areas to reduce the energy consumption of nodes while transmitting data between the more extensive network. [PERSON] et al. [16] proposed the SEP protocol in a heterogeneous two-level hierarchical network; each sensor node independently selects itself as a cluster head based on its initial energy compared to other nodes. The Energy Level Based Stable Election Protocol (ELBSEP) [17] was proposed, combining some features of SEP and the energy level estimation method. The proposed method could increase energy efficiency, improving the lifetime of the network. However, ELBSEP is unsuitable for frequent information from Wireless Sensor Networks. This paper proposes an approach to reduce the number of cluster heads, minimise distances, lower energy consumption, and improve network stability and lifetime. The KNN algorithm was used by the authors to modify the TEEN protocol; this study successfully demonstrates that integrating the KNN algorithm into the TEEN protocol enhances cluster head selection, leading to improved energy efficiency and network performance in WSNs. This modification addresses key challenges in WSN deployment, such as energy conservation and data reliability, making it a valuable contribution to the field [18]. A new approach was used to optimise WSN deployment by combining the KNN algorithm estimation with a modified metaheuristic algorithm, the Intensified-Hitchcock Bird-Inspired Algorithm (I-HBIA), to determine optimal sensor node placement [19]. This study aims to enhance the deployment process by improving decision-making capabilities in order to provide efficient deployment of WSN configurations. The approach will have some drawbacks, such as the increasing number of node dimensions and not accounting for the number of dead CHs and the location of live CHs. A distributed energy-efficient clustering protocol for heterogeneous WSNs is another phase for cluster selection. Regarding the stability period, DCE performs better than the DEEC, SEP, and LEACH protocols [20]. An intrusion detection model based on KNN was proposed in by [PERSON] et al. ; this study uses a KNN-based intrusion detection system to enhance WSN. It integrates the algorithm for KNN with an arithmetic optimisation algorithm, improving the accuracy and efficiency of intrusion detection. In this respect, the model is simulated for performance testing to prove it detects intrusions within the environment [21]. Another study using a hybrid feature reduction technique was performed; the paper introduces a hybrid model that employs machine learning techniques, including KNN, to enhance the security of WSNs against cyberattacks. The model utilises feature reduction methods like Singular Value Decomposition (SVD) and Principal Component Analysis (PCA) to improve detection accuracy and efficiency [22].