

from typing import Any






class 						__magic_name__    :


 def __init__(						self		: int			,						lowerCAmelCase__		: Any    )    ->      Tuple:
   UpperCAmelCase					      =  data
   UpperCAmelCase					      =  None






class 						__magic_name__    :


 def __init__(						self		: Tuple    )    ->      Tuple:
   UpperCAmelCase					      =  None


 def _UpperCamelCase	(						self		: Dict    )    ->      List[str]:
   UpperCAmelCase					      =  self.head
   while temp is not None:
     print(temp.data			,						end=" "    )
     UpperCAmelCase					      =  temp.next
   print()


 def _UpperCamelCase	(						self		: str			,						lowerCAmelCase__		: Any    )    ->      Optional[int]:
   UpperCAmelCase					      =  Node(lowerCAmelCase__    )
   UpperCAmelCase					      =  self.head
   UpperCAmelCase					      =  new_node


 def _UpperCamelCase	(						self		: str			,						lowerCAmelCase__		: Any			,						lowerCAmelCase__		: int    )    ->      str:
   if node_data_a == node_data_a:
     return
   else:
     UpperCAmelCase					      =  self.head
     while node_a is not None and node_a.data != node_data_a:
       UpperCAmelCase					      =  node_a.next

     UpperCAmelCase					      =  self.head
     while node_a is not None and node_a.data != node_data_a:
       UpperCAmelCase					      =  node_a.next

     if node_a is None or node_a is None:
       return

     UpperCAmelCase      ,	UpperCAmelCase					      =  node_a.data, node_a.data


if __name__ == "__main__":
      lowerCAmelCase__       = LinkedList()
      for i in range(5, 0, -1):
            ll.push(i)

      ll.print_list()

      ll.swap_nodes(1, 4)
      print("After swapping")
      ll.print_list()






import copy
import os

import cva
import numpy as np
from matplotlib import pyplot as plt






class 						__magic_name__    :


 def __init__(						self		: Optional[int]    )    ->      Optional[Any]:
   UpperCAmelCase					      =  ""
   UpperCAmelCase					      =  ""
   UpperCAmelCase					      =  []
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  2_5_6
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  0
   UpperCAmelCase					      =  0


 def _UpperCamelCase	(						self		: Any			,						lowerCAmelCase__		: Optional[Any]    )    ->      List[str]:
   UpperCAmelCase					      =  cva.imread(lowerCAmelCase__			,						0    )
   UpperCAmelCase					      =  copy.deepcopy(self.img    )
   UpperCAmelCase      ,	UpperCAmelCase      ,	UpperCAmelCase					      =  plt.hist(self.img.ravel()			,						2_5_6			,						[0, 2_5_6]			,						label="x"    )
   UpperCAmelCase					      =  np.sum(lowerCAmelCase__    )
   for i in range(len(lowerCAmelCase__    )    ):
     UpperCAmelCase					      =  x[i] / self.k
     self.sk += prk
     UpperCAmelCase					      =  (self.L - 1) * self.sk
     if self.rem != 0:
       UpperCAmelCase					      =  int(last % last    )
     UpperCAmelCase					      =  int(last + 1 if self.rem >= 0.5 else last    )
     self.last_list.append(lowerCAmelCase__    )
     UpperCAmelCase					      =  int(np.ma.count(self.img    ) / self.img[1].size    )
     UpperCAmelCase					      =  self.img[1].size
   for i in range(self.number_of_cols    ):
     for j in range(self.number_of_rows    ):
       UpperCAmelCase					      =  self.img[j][i]
       if num != self.last_list[num]:
         UpperCAmelCase					      =  self.last_list[num]
   cva.imwrite("output_data/output.jpg"			,						self.img    )


 def _UpperCamelCase	(						self		: str    )    ->      int:
   plt.hist(self.img.ravel()			,						2_5_6			,						[0, 2_5_6]    )


 def _UpperCamelCase	(						self		: Dict    )    ->      Optional[Any]:
   cva.imshow("Output-Image"			,						self.img    )
   cva.imshow("Input-Image"			,						self.original_image    )
   cva.waitKey(5_0_0_0    )
   cva.destroyAllWindows()


if __name__ == "__main__":
      lowerCAmelCase__       = os.path.join(os.path.basename(__file__), "image_data/input.jpg")
      lowerCAmelCase__       = ConstantStretch()
      stretcher.stretch(file_path)
      stretcher.plot_histogram()
      stretcher.show_image()



