public void encode_file(String filename)throws FileNotFoundException, IOException
    {
     
            //C:\Users\Manu\Desktop\Workspace\IntelliJ\HuffmanCoding\src\test.txt
            //System.out.print("Enter the filepath: ");
            
           
                BufferedReader br= new BufferedReader(new FileReader(filename));
                String line;
                
                while((line=br.readLine())!=null)
                   input_string+=line;
                //ip_size=input_string.length()*2;
                int freq[] = new int[X];
                pq=null;
                for(int i=0;i<input_string.length();i++)
                     freq[input_string.charAt(i)]++;
                for(int i=0;i<X;i++)
                   if(freq[i]>0)
                     insert(new Pnode((char) i,freq[i],null,null));
           
                while(count>1){
                     Pnode x1=delete();
                     Pnode x2=delete();
                     insert(new Pnode('\0',x1.freq + x2.freq,x1,x2));
                 }
                root=delete();
                table = new String[X];
                traverse(root,"");
                encoded_string = "";
       
                for(int i=0;i<input_string.length();i++)
                 encoded_string+=table[input_string.charAt(i)];
                
               br.close();
    }