Sort Ask Programming |
- Sort
- Write an assignment statement that computes the remainder of the variable time when divided by 60 and stored in the variable minutes. (Assume all are of type int.)
- [Java] Advice on Game of 15 Question
- Could use some insight on these wrong problems.
- Error when printing with printf in Java
- [C] Need help understanding how to solve a problem using qsort
- Csharp Problems From a Beginner, Can you help?
- Recommend a book on Django?
- Best command line interface for C++ on windows?
- (Java) How to change global string value?
- Need daily values for s&p 500
- In need of a database recommendation.
- Have 2 great options, not sure which one to take..
- User Voting on Google Sheet
- How to detect anomaly and recognize pattern using Markov Models
- What to use for an application that needs: GUI and.EXE file? python/golang/javascript
- Question about DB connection between mobile app and webpage
- Single Page Application on Angluar problem
- Coding for primary school students
- Store ENV variables on S3?
- [EBNF Grammar] Correct order?
Posted: 03 Feb 2018 09:28 PM PST Sorting interactive problem from atcoder The problem :: There are N balls labeled with the first N uppercase letters. The balls have pairwise distinct weights. You are allowed to ask at most Q queries. In each query, you can compare the weights of two balls (see Input/Output section for details). Sort the balls in the ascending order of their weights. Explanation of the problem: Given the value of N where N ranges from [1,26] and Q where Q is the maximum number of queries that one can make, sort a list of distinct uppercase alphabets in ascending order. N indicates that there are N characters starting from 'A'. Hence, N = 5 means that our final list must contain 'A', 'B', 'C', 'D' and 'E'. A single query is defined as printing out a string "? x y" where x and y represent the characters we want to check the relation between (e.g. "? A B"). The problem restricts the number of such queries to Q. Hence, we must determine the final order of the characters using at most Q queries. For each query, we get a binary answer '<' or '>' from stdin. '<' indicates that x comes before y in the final list. '>' means otherwise. Input example : N Q -> 3 10 (N is the total balls, Q is the query that we can ask about the relation of the ball) Output :? AB Input: > (means that B is bigger than A) Output :? CB Input : > (answer from stdin) Output: ?AC Input :< (means A is bigger than C) Output :!BAC (sorting in ascending) Constraints (N,Q)=(26,1000), (26,100), or (5,7). First im not quite sure how can i code "? x y"? Im picturing there will be array with For N ball. For example "ABC" but how can i code to ask randomly for query? Such as "?AB " then " ?CB " then " ?AC " from array ? Since there is constraint for Q(query) i mean how can i code something that only give output " ?AB" ," ?CB", "?AC " and not giving output such as ?BA ?BC ?CA (the reversed and repetition one) And also i am very very beginner havent learn anything abt merge sort etc and sort algorithm, is this knowledge require to code this problem? please give me hint how can i approach this problem? this is sample of the code that is seem accepted for the first case (26,1000), but i was confuse as there is no Q in this code? because when i tried to debug the code, it ask questions with total bigger than Q(constraint) ... my attempt using c but WA, i tried using bubble sort... but i know this completely wrong, thats all i know for algorithm.. [link] [comments] | ||
Posted: 03 Feb 2018 08:50 PM PST | ||
[Java] Advice on Game of 15 Question Posted: 03 Feb 2018 08:47 PM PST Hey all, I am working on a problem and not sure how to go about it. We are writing two aspects of a program - a human part and a computer portion. The program works with a 4x4 2D array with numbers 1-15, and one blank spot. I completed the human portion, but I'm confused about how to approach the computer portion. First, I have to solve a relaxed version, in which I just have to way in which the program prints out how to get the blank square in the bottom right part of the arrow. The Game of 15 does not have to be solved, but I have to print out the way in which it would get the blank square to the bottom right (the star represents the blank spot). So for instance, if the array was like this: 1 2 3 4 5 * 6 7 8 9 10 11 12 13 14 15 The program would print 'up, up, left, left' to get the blank square on the bottom right. I was given a method that gives me the point of the array in which it is blank. Thank you so much for any help! [link] [comments] | ||
Could use some insight on these wrong problems. Posted: 03 Feb 2018 08:24 PM PST Which of the following is a literal? a. int b. main c. + d. 77 f. salary Me and my friends all agreed on int, but it keeps saying it is wrong. [link] [comments] | ||
Error when printing with printf in Java Posted: 03 Feb 2018 07:45 PM PST My code: I'm trying to print the output with no decimal places after the number, but I'm getting an error when trying to print. [link] [comments] | ||
[C] Need help understanding how to solve a problem using qsort Posted: 03 Feb 2018 07:04 PM PST So this is for an assignment; the task was to ask the user a word and then find it within directories and captilize it. That part I have figured out. Then the program is supposed to give you a report BUT it needs to be sorted by most updated file first. Which as you can see is not what I have done: I did it by creating a counter variable and adding 1 to it whenever the word gets replaced and simply printing the path and counter as the program goes folder-by-folder. But it needs to be sorted; using qsort. So I believe I'll have to create an array first and then use qsort but I do not understand how to do that. What will the array hold? The path or the counter? Because I don't believe it can hold both. Also the part that does the sorting needs to be on a different .c file if that matters. Any help would be appreciated! Thank you! [link] [comments] | ||
Csharp Problems From a Beginner, Can you help? Posted: 03 Feb 2018 06:18 PM PST I've been coding for less than a week now, im working to making a block move...the code (from visual studio) is being rejected from an unexpected "{" when it is seen to work by others. here's from the code: public class PlayerMovement : MonoBehaviour { } yes i am working with unity and would love some help, Thanks Guys! /r/FirstTime - SlowEngineering P.S. this is my first post so i'm sorry if i've done anything wrong [link] [comments] | ||
Posted: 03 Feb 2018 05:41 PM PST A year ago, I read "Getting MEAN With Mongo, Express, Angular, and Node" by Simon Holmes. This book went through the MEAN stack by creating an application from the UI all the way to user authentication. It really helped me learn MEAN because it allowed me to create something while understanding concepts. I'm now looking to learn Django. Is there a book that does something similar where it creates a simple web application using Django and explains things as you go along? [link] [comments] | ||
Best command line interface for C++ on windows? Posted: 03 Feb 2018 01:09 PM PST I'm pretty new to programming and im using cygwin with VS and I'm feeling kinda iffy about cygwin [link] [comments] | ||
(Java) How to change global string value? Posted: 03 Feb 2018 04:52 PM PST Very noobish question and i cant google it. class: public class NewClass { } Dialog: public class Dia extends javax.swing.JDialog { Always gets me error that it cant find variable in class [link] [comments] | ||
Posted: 03 Feb 2018 03:02 PM PST I'm creating a csv of the daily open close and volume of all the stocks in the s&p 500. Currently I curl alphavantage for each and concatenate them. But there has to be a better way. I just need a way to get the data not necessarily a program. [link] [comments] | ||
In need of a database recommendation. Posted: 03 Feb 2018 10:28 AM PST I have 5TB of CSV files each containing lines like the following: That's just an example. I need to be able to query this data like so: In other words, show me all rows where company is Oracle (case insensitive), or show me all rows where company is Oracle (again case insensitive) and title is Software Engineer (also case insensitive). The data is not relational. Some of the data looks like this: Again, I want all rows that match cancer (case insensitive), ordered by the count. I imported the data into a Postgres database using COPY, and that took about a day. I started creating indexes on the tables a couple of days ago, e.g.: That table is ~115GB and the indexing has been running for over 24hours now. Considering I have 60 tables, some quite larger than this one, it's just not something I want to wait a month+ for. Just wondering, for this type of data, if there might be something better. [link] [comments] | ||
Have 2 great options, not sure which one to take.. Posted: 03 Feb 2018 01:15 PM PST
| ||
Posted: 03 Feb 2018 11:59 AM PST Hello. Would it be possible to create something where users can vote (like reddit) on entries in a Google Sheet or database? I am using Wordpress to host it. I have very little programming knowledge. Thanky you. [link] [comments] | ||
How to detect anomaly and recognize pattern using Markov Models Posted: 03 Feb 2018 10:57 AM PST I am using markov models for my project "Anomaly detection and Pattern Recognition using Markov Models". I need suggestions regarding language and packages which would suit my needs. I've started some work where I am building markovchains with sequential mood data. Right now I am working with R package "markovchain". Now I need to estimate future mood, identify a sequence of mood for someone. My Github Repo - https://github.com/sahilsharma011/prediction_anamoly_detection_cs_project [link] [comments] | ||
What to use for an application that needs: GUI and.EXE file? python/golang/javascript Posted: 03 Feb 2018 08:50 AM PST I have small application: 1. User input data into few input-boxes. 2. The application performs HTTP request with the given data. 3. The application generates files on disk based on HTTP response data. I have the whole thing (except GUI) already written in python and golang. I don't know javascript but for such a simple project i can learn some. I want to pack this into .exe with GUI. From my experience packing python project into .exe is not so simple and leads to problems. There is also a lot of GUI libraries, but they are aged and stable. With golang making, exe is really simple, but all GUI libraries that i found looks like in beta - testing. Now comes javascript with Electron, looks like the best approach for this but also approach i want to avoid at last. [link] [comments] | ||
Question about DB connection between mobile app and webpage Posted: 03 Feb 2018 08:32 AM PST I'm making a project that basically consists of an app that will be updating a DB and a webpage that will read the DB and present the data in graphics and some other things. The question is when the DB is updated by the app how can I notify the webpage? I thought of using a websockets server only to send an update notification to when the DB is updated, but I think it may be too overkill to use a websockets server only to notify changes. A friend suggested me to use MQTT I read a little about it and I like the fact that you can subscribe to topics but I don't know if there is a better tool to do what I want. I want to add that the webpage can also write to the DB and that I will have a lot of data in the DB. TL; DR: I'm doing a project where I need to connect a webpage and an app to a DB and I want them to know when the DB changes. Thanks to everyone I appreciate any response! [link] [comments] | ||
Single Page Application on Angluar problem Posted: 03 Feb 2018 06:42 AM PST I'm currently making website in SPA architecture for my classes. I've encountered a problem. When I was coding routing I made html files with simple text just as a placeholder to check if routing works. Everyting worked fine. Now when I change something in my project (for eg. change text of heading) it doesn't change in browser. It looks like the browser have some kind of snapshot of my project in it. I tried deleting history cookies etc. and it worked, but is there any way around? I honestly don't feel like deleting history every time I want to run my project. tl;dr SPA website doesn't update to my project code [link] [comments] | ||
Coding for primary school students Posted: 03 Feb 2018 12:43 AM PST Hi r/askProgramming, I am a primary school teacher and I currently have a few students in my class who enjoy using https://scratch.mit.edu/ to make games. I have one student in particular who has out grown scratch and would be quite capable of learning a language. I dont want to squander his ability and would love to point him to a language that he would be able to eventually use to build a game out of. What would be a good language and is there a great free online based program I can point him towards? I am hoping that he would be able to eventually take what I teach him now and use it during high school in unity. Any advice is great advice!!! Thank you [link] [comments] | ||
Posted: 03 Feb 2018 05:46 AM PST I have these .env files that I use to configure a Rails app. The files are not versioned but I'm keen to encrypt them and push them them to Github with a tool like this: https://github.com/sobolevn/git-secret The things is that everyone tells not to push secrets to Github, so I was wondering what would be a good alternative. I thought about saving the files on a S3 bucket for instance and manage them somehow. Then pull them on the CI/CD process. I'm already using the aws cli in the process so it would be fairly easy to integrate. Given that we can secure the bucket and encrypt the files, do you see any downside of using S3 for this? [link] [comments] | ||
Posted: 03 Feb 2018 05:33 AM PST Hello I'm currently doing more testing on my expression grammar in my parser to check if everything is alright, and I noticed this : Evaluates to 4 with my current grammar, because it's derived like this: But, if I evaluate it in google, or in python I get 1.414... because they derive it like this : So, I think I should be in the wrong here, but is that it, or this expression is just really ambiguous by nature, and can be interpreted in 2 ways? My current grammar is this : I think that to get the "correct" result in that specific case I should change it to But then other expressions will evaluate differently because unary operators will have precedence over everything. How can I fix this? EDIT: This post's accepted answer concludes that there is no general "correct" rule for this operation, and that brackets should always be used to get the desired result.* EDIT2: After looking at Python's grammar, I came up with this grammar, that solves the problem (I think?) That leaves me with this order of operation:
Which is, I think, correct ? It's nearly the same as C++'s order of precedence, (if you replace the scope resolution operator with the exponent operator) http://en.cppreference.com/w/cpp/language/operator_precedence Thanks a lot ! [link] [comments] |
You are subscribed to email updates from AskProgramming. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment